With just a little tidying the for loop version looks much better and is easier to understand (at least for me) than the map version. Consider:
foreach (@teststr) { my $val = (split /\//)[-1]; $testhash{substr $val, 0, index $val, '.txt'} = $val; }
In reply to Re: hash assignment using map with multiple statements
by GrandFather
in thread hash assignment using map with multiple statements
by diomedea
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |