I love it when i write up complete crap about needing to check existance of
keys...

the following code will merrily suffice:

#########################

open I, "state.txt";

my %codes;

while (<I>) {
 chomp;  #remove newline

 s/\s+//g;  #remove white space

 my @entry = split ':'; #split on :

 push @{$codes{$entry[1]}}, $entry[0];
}

for (sort keys %codes) { print $_, " = ", join ',',@{$codes{$_}}, "\n" }

#########################

sorry about the confusion.

> 2 we need to check whether a key already exists or not. if so, we add the
> entry to the list represented by the key, if it doesnt exist yet, we make
it
> and go on our merry way.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to