On Sat, 09 Feb 2002 13:49:59 +0000, Terri Harrison <[EMAIL PROTECTED]> wrote: > What do I do so that the Name is the key and the Species and Gender > together are the value?
You were not too far from what you wanted to do. #!/usr/bin/perl -w use strict; my %zoo; while (<DATA>){ chomp; # Split the line in two elements, after the first space my @elements = split(/ /, $_, 2); # Assign the first element as the key and the last as the value $zoo{$elements[0]} = $elements[1]; } # Let's check the results: print "$_ => $zoo{$_}\n" foreach keys %zoo; __DATA__ Happy Cat Male Evil Snake Female Patches Dog Male Bubbles Fish Female Harley dog Female Goldy Fish Male __END__ -- briac << dynamic .sig on strike, we apologize for the inconvenience >> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]