in reply to arrays and hashes blended !
My only disappointment is that this is not a Perl-ish recipe for a mixed drink. :(
My only suggestion is to avoid using 'hard coded' hash keys and array indices. I prefer to use a while loop to gather STDIN instead of a for loop, but there are many, many different ways to do this. Here's my take on it:
Feel free to ask any questions you may have about this code. :)use strict; use warnings; my %hash; my @array; my $key = 'aa'; my $prompt = "\nEnter value <cntl-d exits>: "; print $prompt; while (<STDIN>) { chomp; push @array, $_; print $prompt; } $hash{$key++} = $_ for @array; print "\n"; print "$_ contains $hash{$_}\n" for sort keys %hash;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|