in reply to Having trouble loading a hash with map
#!/usr/bin/perl -w use strict; use Data::Dumper; { local $/; # unset the input record seperator in order to slurp the + contents of STDIN my %hash; %hash = map { chomp; $_ => '1' } split /(\s+|\W+)/, <>; } print Dumper(\%hash); # because that's how it's supposed to be used ;)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Having trouble loading a hash with map
by AnomalousMonk (Archbishop) on May 03, 2012 at 18:58 UTC |