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

Re: Foreach in a 2D array

by ihb (Deacon)
on Oct 28, 2004 at 09:15 UTC ( #403323=note: print w/ replies, xml ) Need Help??


in reply to Foreach in a 2D array

You need to dereference the array before iterating through it, otherwise you iterate over one element (the reference). That means you need to change $dataoptions{$columns[$i]} to @{$dataoptions{$columns[$i]}}.

Related documents:
perlref - Perl references and nested data structures
perlreftut - Mark's very short tutorial about references
perllol - Manipulating Arrays of Arrays in Perl
perldsc - Perl Data Structures Cookbook

ihb

See perltoc if you don't know which perldoc to read!
Read argumentation in its context!


Comment on Re: Foreach in a 2D array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2014-12-27 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls