Perlcast

Perl Testing Contest: Round 1

This week O’Reilly has provided five copies of Perl Testing: A Developer’s Notebook for Perlcast to give away. You might remember that Perlcast did an interview with Ian Langworth and chromatic, the authors of Perl Testing, a month or so ago.

Monday through Friday of this week, we will be holding a daily contest for a copy of Perl Testing. Each contest will take the form of a question. Answers should be emailed to perlcast at gmail dot com. Entries will be accepted for 24 hours following each contest posting. Everyone with a correct answer will be entered into a drawing to be held soon after each days submission deadline.

Today’s question comes straight from the sample chapter available online at O’Reilly. Here goes:

“Perl’s documentation suggests using h2xs to create new modules. What module, that Ian and chromatic mention, is just a modern alternative for the h2xs method?”

Good luck and thanks for listening.

Contest 4

Okay, contest four is all about “There Is More Than One Way To Do It”. For this contest, take the string 'a string to fOrMaT' and format it so that the first letter of each word is capitalized and all other letters are lower case. I’ve got an example of one way to do it below. Send me all of the ways that you can do it before noon CST on June 24th. The person with the most ways wins a copy of the upcoming edition of Advanced Perl Programming.

Here is my sample:

$x = 'a string to fOrMaT';
print join(' ',(map {ucfirst lc $_} (split /\s+/, $x)));"

Here is the resulting string:

A String To Format

Good luck!

Advanced Perl Programming, 2nd Edition – Contest 3

This contest is quite a bit easier than the last. In the code below, you get the output of ‘file.da’ instead of the intended output of ‘file’. What is wrong with the regex? Send the repaired regex to perlcast at gmail dot com before 17th June 2005 at noon CST to be entered in the drawing for a copy of Simon Cozens upcoming book Advanced Perl Programming, 2nd Edition.

For Windows Users:

perl -e "$x='file.dat';print $1 if($x=~/(.*).(.*)/)"

For Unix/Linux/etc Users.:

perl -e '$x="file.dat";print $1 if($x=~/(.*).(.*)/)'

Advanced Perl Programming, 2nd Edition – Contest 2

Okay, so the first contest (which is still going on) required a little coding knowledge. This one requires nothing of the sort. Bascially, there are two catch-phrases that I have used for Perlcast:

  • Perl news, Reviews, and More
  • Podcasting Perl

These both pretty much stink. So from now until June 17th, email perlcast at gmail dot come with suggestions for new tag lines. After the 17th, I’ll put my favorites on this site and open up voting (still working on the method of voting). Between the 18th and 30th votes will be accepted. Whoever sent in the highest ranked tag-line first will win a copy of Advanced Perl Programming.

Advanced Perl Programming, 2nd Edition – Contest 1

The broken code for the first contest can be found below. In the code, the hash { a => 1, b => 2 } is being passed through Data::Dumper and then eval’ed back into a hash. This works fine, until strict comes into the picture. When strictness is enabled, the code fails with the error: “Can’t use an undefined value as a HASH reference”. How can you make this work and still keep strictness for all of the code.


perl -Mstrict -MData::Dumper -e 'my %x = %{eval Dumper({ a => 1, b => 2 })}';

Email perlcast at gmail dot com the answer to this, along with the comment that I mentioned in Perlcast 12 and you will be entered into the contest drawing. The deadline for entry is this Friday at noon CST (2005-06-10 12:00:00 UTC-5).

« Previous Pageprevious »
« newer Next Page »