#!/usr/bin/perl use warnings; use strict; my @gifts = <DATA>; my @days = qw(1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th); my @dayspast; while(@days){ my $day = shift @days; push @dayspast, $day; my ($num) = $day =~ /(\d+).*/; print "On the $day day of Christmas,\nMy true Perl gave to me\n"; foreach my $gift (reverse @dayspast){ my ($n) = $gift =~ /(\d+).*/; print $gifts[$n - 1]; } print "\n"; if(scalar @dayspast == 1) {$gifts[0] = 'And '.$gifts[0]} } exit; __DATA__ a commandline in an @ARGV 2 sca-lars 3 ar-rays 4 nested hash 5 ENCODED STRINGS 6 threads-a-spawning 7 procs-a-forking 8 tests succeeding 9 modules loading 10 objects blessing 11 signals catching 12 saints-a-drinking
In reply to 12 Days of Christmas by zentara
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |