[oak perl] foreach (@{\@{\@... --> foreach (1..12)
Michael Paoli
Michael.Paoli at cal.berkeley.edu
Tue Sep 26 21:00:48 PDT 2006
Stumbled across this wee bit which covers a simple point in a rather well
illustrated way:
--------------------------
Message 10444 on *Nerds (#78001):
Date: Tue Sep 26 11:08:43 2006 PDT
Your first part could be along this:
@months = qw/ January February March April May June
July August September October November December /;
foreach (@{[1..12]}) {
print "$_ ) $months[$_-1]\n";
}
--------------------------
Message 10445 on *Nerds (#78001):
Date: Tue Sep 26 11:54:44 2006 PDT
@months = qw/ January February March April May June
July August September October November December /;
foreach (@{\@{\@{\@{\@{\@{\@{\@{\@{\@{\@{\@{\@{[1..12]}}}}}}}}}}}}}) {
print "$_ ) $months[$_-1]\n";
}
works too!
Or just leave the unnecessary crap out altogether and use
foreach (1..12)
--------------------------
references:
telnet://lambda.moo.mud.org.:8888
@peek 10444 on *Nerds
@peek 10445 on *Nerds
More information about the Oakland
mailing list