in reply to Storing Text file in hash
Here's a quick snippet that should suggest the type of structure that could work for the task:
my %hash; while (my $line=<IN>) { # I assume an open IN filehandle chomp $line; ($username, $realname, $pwd) = split /\t/, $line; # I assume tab del +imiter $hash{$username} = [$realname, $pwd]; }
Then you can access someuser's realname or password like:
$realname = $hash{'someuser'}->[0]; $pwd = $hash{'someuser'}->[1];
My recommendation would be to look at the references manpage for the background on how to build and work with simple data structures.
Good luck.
..Guv
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Storing Text file in hash
by dnickel (Novice) on Mar 11, 2002 at 20:25 UTC |