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:
Printing an anonymous array of a hash

 



SQA777
New User

Jul 29, 2011, 9:04 PM

Post #1 of 2 (645 views)
Printing an anonymous array of a hash Can't Post

I created an anonymous array. Each element is a hash.


Code
my $ref = [ {'name' => "John", 'company' => "Ford", 'project' => "Taurus" }, 
{'name' => "Doe", 'company' => "Ford", 'project' => "Fiesta" } ];


I want to print the whole anonymous list. I don't want to print each element of the array with a foreach command.



Code
print "$ref \n"; 
print @{$ref};

...do not work.

How do I print out the whole array of hash elements?


FishMonger
Veteran / Moderator

Jul 29, 2011, 9:27 PM

Post #2 of 2 (642 views)
Re: [SQA777] Printing an anonymous array of a hash [In reply to] Can't Post

use Data::Dumper;

print Dumper $ref;

 
 


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

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