On Sat, Jun 16, 2001 at 09:31:13AM -0700, Peter Scott wrote:
> At 09:15 AM 6/16/2001 -0700, Ron Anderson wrote:
> >
> >And can I sort the hash by last name and then first name?
>
> Consider using instead a hash-of-hashes or hash-of-arrays(perldoc perllol).
And when you need more efficiency type
> But, if you did, I think this should work:
But then it is saturday morning. Sigh. Ignore my
attempt; use Peter's.
> sub room { my $s = $shash{$_}; (split /\t/)[2] };
Wrong, twice. You wanted lastname, not room.
And the split isn't working on the right thing.
Peter's solution is clearer, n
> $shash{"student1"} = join("\t", ("bob", "tyson", "room5"));
> $shash{"student2"} = join("\t", ("ron", "anderson", "room4"));
> $shash{"student3"} = join("\t", ("dave", "lee", "room2"));
> $shash{"student4"} = join("\t", ("tim", "barker", "room3"));
> $shash{"student5"} = join("\t", ("roger", "fa
At 09:15 AM 6/16/2001 -0700, Ron Anderson wrote:
>Hi!
>
>Using the following hash as an example:
>
>$shash{"student1"} = join("\t", ("bob", "tyson", "room5"));
>$shash{"student2"} = join("\t", ("ron", "anderson", "room4"));
>$shash{"student3"} = join("\t", ("dave", "lee", "room2"));
>$shash{"stude
Hi!
Using the following hash as an example:
$shash{"student1"} = join("\t", ("bob", "tyson", "room5"));
$shash{"student2"} = join("\t", ("ron", "anderson", "room4"));
$shash{"student3"} = join("\t", ("dave", "lee", "room2"));
$shash{"student4"} = join("\t", ("tim", "barker", "room3"));
$shash{"s