in reply to Re: suppress the elements that appear more than one time in a list
in thread suppress the elements that appear more than one time in a list


Thanks a lot FunkyMonk

I have tried your method.

However, I did not understand the line :$Hash{$k} += $v;
I replaced with line :$Hash{$v} = $k;
because I would like o have a unique list of the letters (not the numbers)
  • Comment on Re^2: suppress the elements that appear more than one time in a list

Replies are listed 'Best First'.
Re^3: suppress the elements that appear more than one time in a list
by johngg (Canon) on Aug 01, 2007 at 13:05 UTC
    It would perhaps be better from a maintenance point of view to leave the line

    $Hash{$k} += $v;

    as it is and change the split to reflect the fact that your value comes before the key on the line

    my ($v, $k) = split /;/;

    You still need to use += since you wish to accumulate the values.

    Cheers,

    JohnGG