Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

How not to remove trailing empty strings from an array

by ambrus (Abbot)
on Apr 16, 2013 at 10:54 UTC ( #1028872=perlmeditation: print w/ replies, xml ) Need Help??

Just a quick note to document a funny error.

I tried to remove trailing empty strings from an array of strings with the following code.

pop @msgstr while !length($msgstr[-1]);

This didn't work. Can you guess why? Solution under the fold.

Comment on How not to remove trailing empty strings from an array
Select or Download Code
Re: How not to remove trailing empty strings from an array
by Neighbour (Friar) on Apr 16, 2013 at 14:32 UTC
Re: How not to remove trailing empty strings from an array
by LanX (Canon) on Apr 16, 2013 at 17:17 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1028872]
Approved by kcott
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-09-22 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls