Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: multidimensional array's

by 7stud (Deacon)
on Dec 27, 2012 at 21:10 UTC ( #1010577=note: print w/ replies, xml ) Need Help??


in reply to multidimensional array's

use strict; use warnings; use 5.012; my $row1_ref = ['a', 'b', 'c']; my $row2_ref = ['xx', 'yy', 'zz']; my $data; push @$data, $row1_ref; push @$data, $row2_ref; use Data::Dumper; say Dumper($data); --output:-- $VAR1 = [ [ 'a', 'b', 'c' ], [ 'xx', 'yy', 'zz' ] ];
my( $author, $title, $results ) ; while ( my($lineno, $row_ref) = each @$data) { $author = $row_ref->[0]; $title = $row_ref->[1]; $results->[$lineno]->[1] = $row_ref->[2]; } say Dumper($results); --output:-- $VAR1 = [ [ undef, 'c' ], [ undef, 'zz' ] ];


Comment on Re: multidimensional array's
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-12-20 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (95 votes), past polls