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

Re: Looping through multiple arrays

by Discipulus (Canon)
on Mar 05, 2015 at 11:51 UTC ( [id://1118877]=note: print w/replies, xml ) Need Help??


in reply to Looping through multiple arrays

You are wrong in declaring the array:
perl -MData::Dumper -e "@arr=['a','b']; print Dumper (\@arr)" $VAR1 = [ [ 'a', 'b' ] ];
You are declaring arrays with only one element which turns to be an anonyomous array.

Without getting deep in what your data means or meant to be used, you have to do something simple as:
perl -MData::Dumper -e "@arr1=qw(a b);@arr2=qw(c d);foreach (@arr1,@ar +r2){print qq([$_]\n) }" [a] [b] [c] [d]
HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2026-04-13 18:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.