#!/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 ;)
In reply to Re: Having trouble loading a hash with map
by Utilitarian
in thread Having trouble loading a hash with map
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |