Perl Monk, Perl Meditation | |
PerlMonks |
Re: How to call a function on each item after a split?by 2teez (Vicar) |
on Oct 08, 2012 at 21:40 UTC ( [id://997882]=note: print w/replies, xml ) | Need Help?? |
Hi,
Please, before one shutdown the wonderful solution first given by aitap above on this issue, Why use chomp and then sepeartely, remove spaces? At the beginning and endling of each value? I thought, \s+ also covers \n that chomp is suppose to remove? I modified the OP clean subroutine and both map and grep gave the happy endling. So, there is really no need for the extra $_ as perviously stated, if the modified subroutine is considered. check below: OUTPUT
If you tell me, I'll forget. If you show me, I'll remember. if you involve me, I'll understand. --- Author unknown to me
In Section
Seekers of Perl Wisdom
|
|