in reply to arrays and hashes blended !
No need to store values in an intermediate array.
use strict; my %new_hash_experiment = map {($_, undef)} qw(aa ab ac ad ae af); foreach my $key (sort(keys(%new_hash_experiment))) { print "\nEnter a value for key: $key: "; chomp($new_hash_experiment{$key} = <STDIN>); } foreach (sort keys %new_hash_experiment) { print "$_ contains $new_hash_experiment{$_}\n"; }
Hazah! I'm Employed!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: arrays and hashes blended !
by prad_intel (Monk) on Oct 03, 2005 at 06:08 UTC |