use strict; use warnings; my $str = "a,b=c,e=#f"; my @result = map { /(\w+)(=(#?)(\w+))?/; defined $3 && $3 eq '#' ? "$1=>fn($4)" : defined $2 ? "$1=>$4" : "$1=>fn($1)" } split ',', $str; print "@result";
Prints:
a=>fn(a) b=>c e=>fn(f)
In reply to Re: map a list
by GrandFather
in thread map a list
by evil_otto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |