Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: multidimensional array printing

by Marshall (Prior)
on Aug 26, 2012 at 05:19 UTC ( #989787=note: print w/ replies, xml ) Need Help??


in reply to multidimensional array printing

Try using:

use Data::Dumper; print Dumper \@something;
Data::Dumper is a core module and is a part of all Perl installations. You will see this extra "\n" in your code.

#/usr/bin/perl -w use strict; use Data::Dumper; my @twoD = (['x', 32], ['y', 45]); #a 2D array is an array of references to array print "Using row reference...\n"; foreach my $row_ref (@twoD) { print "@$row_ref\n"; } print "\n",'$twoD[1][1] is ',"$twoD[1][1]\n"; #prints 45 print "\nUsing Data::Dumper\n"; print Dumper \@twoD; __END__ Using row reference... x 32 y 45 $twoD[1][1] is 45 Using Data::Dumper $VAR1 = [ [ 'x', 32 ], [ 'y', 45 ] ];


Comment on Re: multidimensional array printing
Select or Download Code

Log In?
Username:
Password:

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

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

    My preferred Perl binaries come from:














    Results (200 votes), past polls