in reply to Hash Variable
The code is more dense, but therefore more fun. Look at perldata, map, perlop and perlref for docs.my %hash; while( <DATA> ){ chomp; @vars = map { s/^\s+$// } split /,/; $hash{ $vars[2] } = [ @vars[ qw/0 1 3/ ] ] if $vars[0]; }
Hope this helps,
Jeroen
"We are not alone"(FZ)
Update: mr.nick /msg'ed me a warning:
What if $vars[0] equals a '0'? You still want it to be
valid? add <code> or $vars =~ m/0/<code> to the if
statement.
|
|---|