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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Trouble accessing Hash of Arrays: Edit Log

New User

Apr 1, 2013, 7:16 PM

Views: 784
Trouble accessing Hash of Arrays

I am facing some trouble accessing values from a hash of arrays. I am attaching a sample code (this is not part of the main code but it pretty much shows the problem)


%sampleHash = ();
@array1 = ('a','b','c');
$sampleHash{"hash1"} = @array1;
$sampleHash{"hash2"} = @array2;

print $sampleHash{"hash1"}[0];

In the above code, the print statement is blank. I want it to show the value - a.
Please help. Its urgent.

(This post was edited by sujeet97 on Apr 1, 2013, 7:17 PM)

Edit Log:
Post edited by sujeet97 (New User) on Apr 1, 2013, 7:17 PM

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

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