Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: array references

by DrManhattan (Chaplain)
on Apr 03, 2003 at 03:49 UTC ( [id://247666]=note: print w/replies, xml ) Need Help??


in reply to array references

I'm not sure without <code> tags, but I think what you're trying to do is this:
for $i (0..$#{$ref}) { print $ref->[$i]->[0]; }

That prints the first element of each array in the arrayref.

There are several ways to go about putting the elements into a new array. Here's what I'd do:

my @newarray = map { $_->[0] } @$ref;

-Matt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found