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

Re: arrays and foreach

by chromatic (Archbishop)
on Aug 16, 2012 at 17:14 UTC ( #987834=note: print w/ replies, xml ) Need Help??


in reply to arrays and foreach

Your split is useless. You're pushing eleven distinct elements onto the array, and you're iterating over them one at a time. Print $_ within your loop to see that.

(You can also print your array with Data::Dumper.)

You could instead concatenate the array elements together with . instead of ,, but you're better off using an anonymous array and avoiding the split altogether. (What happens if one of the textual elements contains a semicolon?)


Improve your skills with Modern Perl: the free book.


Comment on Re: arrays and foreach
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2014-11-26 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (160 votes), past polls