Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Variable in a foreach loop

by InfiniteSilence (Curate)
on Jul 16, 2016 at 18:03 UTC ( #1167885=note: print w/replies, xml ) Need Help??


in reply to Variable in a foreach loop

Having to know how many rows and columns there are in a multi-dimensioned array can become tedious. Unless strictly necessary you can avoid it having to code it into your program...

use strict; sub dataSetup { return ( [ qw|a b c d| ] , [ qw|a b c d| ] , [ qw|a b c d| ] ) ; } sub main { my @multi = dataSetup(); foreach my $row (@multi){ foreach(@$row){ print qq|$_\n|; } } } #---- &main;

Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2022-01-16 10:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (49 votes). Check out past polls.

    Notices?