Sunday, June 12, 2005

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=~/(.*).(.*)/)'