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: Beginner: Trouble accessing Hash of Arrays: Edit Log



sujeet97
New User

Apr 1, 2013, 7:16 PM


Views: 702
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)


Code
#!/usr/bin/perl 

%sampleHash = ();
@array1 = ('a','b','c');
@array2=("x","y","z","s");
$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