my $keys = '1 2 3 4 5 6'; my %hash; @hash{split /\s+/, $keys} = ();
Or perhaps
my $keys = '1 2 3 4 5 6'; my %hash = map { $_ => undef } split /\s+/, $keys;
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: splitting directly to hash
by davorg
in thread splitting directly to hash
by narashima
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |