in reply to Re^3: Hash of Array references
in thread Hash of Array references
Thanks a lot..I just got it.. But is there any way to store the number as well in the array?. I need to provide user with 2 options.Either display all the details or display details of any specific number
print "PRESS 1 to display a single number details \n 2 to display all the numbers and details\n or any other key to EXIT :"; chomp($option2=<STDIN>); if ($option2 =="1") { print "Enter the number:"; my $input = <STDIN>; chomp $input; if (exists $users{$input}) { print "@{ $users{$input} }\n"; print "$users{$input}[0] \n"; print "$users{$input}[1] \n"; } else { print "Unknown number.\n"; } } elsif ($option2 == "2") { # display all the numbers and their respective user and co +mments.something like the below one # The details for number 1234567 are user : sam, comments: +changed abc in a file. The details for number 343434 are user:john, comments: d +eleted abc in a file } else { print "Invalid option\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Hash of Array references
by choroba (Cardinal) on Aug 04, 2014 at 15:42 UTC |