We don't bite newbies here... much | |
PerlMonks |
Re: How not to remove trailing empty strings from an arrayby Neighbour (Friar) |
on Apr 16, 2013 at 14:32 UTC ( [id://1028926]=note: print w/replies, xml ) | Need Help?? |
Close, but subtly different (imho), it is an infinite loop if @msgstr becomes the empty list because then -1 returns undef, which causes length to return undef, which is false and gets negated. You could fix this by using pop @msgstr while !length($msgstr[-1]//0); instead (perl v5.10 and up)
In Section
Meditations
|
|