in reply to
splitting directly to hash
If you're willing to give up the blank value for an undefined one. a hash slice will be even simpler:
@hash{split /\s+/,'1 2 3 4 5 6'} = ();
[download]
You'll need to use
exists($hash{$key}
to check for an element's presence instead of
$hash{$key}
, but that's actually faster since you skip the fetch of the value itself.
Comment on
Re: splitting directly to hash
Download
Code
In Section
Seekers of Perl Wisdom