Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: In an array of arrays, how do I print the whole array or bits of it?

by indigo (Scribe)
on Aug 30, 2000 at 21:50 UTC ( [id://30356]=note: print w/replies, xml ) Need Help??


in reply to In an array of arrays, how do I print the whole array or bits of it?

Basically, you write a program to do what you want. :) See the previous respondant for examples. Perl has number of builtins to facilitate array operations, such as foreach, map, and grep. For example, if you have a blended array of values and references, you can do this:
my @lol = ([1, 2, 3], 'x', [qw(A B C)], 'foo'); print join "\n", map {ref $_ ? join ', ', @$_ : $_} @lol;
Additionally, you may wish to look at the Data::Dumper module, which can display complex data structures in a human readable format.
  • Comment on Re: In an array of arrays, how do I print the whole array or bits of it?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (None)
    As of 2024-04-25 04:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found