$i = 1; %hash = ( ('abc' => 7) if (! $i), 'hk' => 5, 'jk' => 6 ); foreach $key (keys %hash) { print "the key is $key and val is $hash{$key}\n" }
2005-02-05 Edited by Arunbear: Changed title from 'Problem with hash', as per Monastery guidelines
In reply to Initializing a hash using conditions by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |