in reply to 1 line array to hash converter
How about the less glamorous:
my %hash = map { $_ => 1 } @array;which gets you off the separate declaration of %hash and is more versatile in the long run. Or to make your example a real oneliner:
my %hash = map { $_ => 1 } (1..10);But i assume that in something real you'd be using an array that existed already.
|
|---|