in reply to Parsing and Matching Text with Map
print Dumper \@employees_my_try;
? You where close, but at the end of the map block you return only whether the match was successful. A bit more munging and stuffing the captured values into an anonymous array will do:
map { $_ =~ m/^employee\[(.*)\] = new employee_element\((.*)\);$/g; my ($index, $text) = ($1, $2); my @list = split/,\s*/, $text; s/"//g for @list; [ $index, @list ]; } split "\n", $data
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|