in reply to Re: Perl: Split/format the output and append it to an array
in thread Perl: Split/format the output and append it to an array

In the interest of balancing clarity and robustness with map, I would suggest the following as an example.

map { /xlink (.+?) /; $1 ? $1 : (); } @xlinks

Of course the trinary operator here is not needed. However, oen problem I have seen with map is accidently clobbering the return values if I am not careful. Therefore if I have a conditional in the return, I try to use a trinary operator at the very end.

BTW, I don't mind putting significant code in a map block. However one does have to be careful about it. I think if the code gets too much, one is better off usually putting the code in a function and calling that rather than going with a for loop.