Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 chanting in the Monastery: (4)
As of 2015-07-06 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (69 votes), past polls