I think that I'd transform the string before splitting it:
#! >perl -slw use strict; use Data::Dumper; $_ = 'a,b=c,e=#f'; s[(\w+)=#(\w+)][$1=>fn($2)]g; s[(\w+)=(\w+)][$1=>$2]g; s[(?<!=>)(\w+),][$1=>fn($1),]g; my %results = split ',|=>'; print Dumper \%results; __END__ C:\test>junk8 $VAR1 = { 'e' => 'fn(f)', 'a' => 'fn(a)', 'b' => 'c' };
In reply to Re: map a list
by BrowserUk
in thread map a list
by evil_otto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |