Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: foreach skipping elements

by Tux (Monsignor)
on Jul 19, 2013 at 15:30 UTC ( #1045377=note: print w/ replies, xml ) Need Help??


in reply to foreach skipping elements

split takes a regular expression as first argument, not a fixed string (there are exeptions). You need -1 as last argument to get trailing empty fields too.

@fields = split /\|/, $_, -1

FWIW, You could also use Text::CSV_XS with sep_char => "|".


Enjoy, Have FUN! H.Merijn


Comment on Re: foreach skipping elements
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045377]
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: (15)
As of 2015-07-31 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (277 votes), past polls