CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Arrays and pushing...

 



getcool207
New User

Jun 28, 2007, 7:52 PM

Post #1 of 3 (328 views)
Arrays and pushing... Can't Post

Hi,

Can someone please explain how to decipher the line containing 'push?

Code
my @array = (); 

for (my $i = 0; $i < 2; $i++){
push @{$array[$i]->{items}}, $i;
}

Thanks in advance.


KevinR
Veteran


Jun 28, 2007, 9:07 PM

Post #2 of 3 (327 views)
Re: [getcool207] Arrays and pushing... [In reply to] Can't Post

The underlying data structure of @array looks like and array of hashes of arrays. What you see is the dereferencing indicators (@{}) and pointers (->) that perl uses to get to the data stored in complex data constucts. See if this helps you:

http://perldoc.perl.org/perldsc.html
-------------------------------------------------


getcool207
New User

Jul 1, 2007, 5:05 PM

Post #3 of 3 (309 views)
Re: [KevinR] Arrays and pushing... [In reply to] Can't Post

Thank you very much KevinR for pointing me in the right direction. It is much appreciated.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives