Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Getting out an array within an array

by Lotus1 (Chaplain)
on Oct 01, 2012 at 20:50 UTC ( #996745=note: print w/ replies, xml ) Need Help??


in reply to Getting out an array within an array

As SundialSvc4 mentioned reading about references should help. Here is a tutorial.

Here is some code to help you out. Tack this on to the end of your program.

use Data::Dumper; print "*"x75,"\n"; print Dumper(@a); print "*"x75,"\n"; chomp @$_ foreach @a; print Dumper(@a); print "*"x75,"\n"; print scalar @a, " elements [references] in \@a\n"; print "*"x75,"\n"; my @new1 = @{$a[0]}; my @new2 = @{$a[1]}; print Dumper($a[0]); print "\@new1 => @new1\n"; print "\@new2 => @new2\n"; print "*"x75,"\n"; foreach (@a) { print "@$_\n"; }


Comment on Re: Getting out an array within an array
Download Code
Replies are listed 'Best First'.
Re^2: Getting out an array within an array
by sokatron (Initiate) on Oct 02, 2012 at 06:52 UTC
    I will definitely check the tutorial but you code was also really useful. Instead of getting nonsense from my attempt to use only @ and not the curly brackets, atleast I can get the values.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-29 08:21 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 (261 votes), past polls