Array enumeration in perl
Posted Tue, 03 Feb 2004
I got bored and thought this atleast marginally useful:
The output is:
my @foo = qw(just another perl monkey);
my $x = 0;
print join("\n",map { $x++ . ": $_" } @foo);
The output is:
0: just 1: another 2: perl 3: monkeyIf you don't know how to use map() then learn, it makes doing large operations on hashes or arrays brutally simple.