
Journal eglamkowski's Journal: neat 3
I don't write perl scripts very often, and when I do they usually aren't anything fancy. So this may seem quaint or elementary to some of you, but I was quite delighted to discover I could do this:
push(@{ $hash{"KEYNAME"} }, "value1");
push(@{ $hash{"KEYNAME"} }, "value2");
push(@{ $hash{"KEYNAME"} }, "value3");
push(@{ $hash{"KEYNAME"} }, "value4");
foreach $string (keys %hash) {
print "$string: @{$hash{$string}}\n";
}
That is to say, a hash where the "value" part of the key-value pair was an array instead of a scalar.
Neat.
No need to do that separately (Score:2)
Re:No need to do that separately (Score:1)
Perl was actually the first langauge I learned. I quickly moved on to C and then C++, but I still like Perl best.
I don't write perl at all (Score:2)