aspirado has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: howto accomodate multiple values
by ysth (Canon) on Dec 26, 2008 at 02:10 UTC
    The easiest way to store multiple values in a hash is to have the hash value be an array reference. An array reference will automatically be created if you just treat it as one:
    my @words = qw/FrobniZZ Shiftboard CocaCola ShiftBoard/; my %cases_found; for my $word (@words) { push @{ $cases_found{ lc $word } }, $word; } for my $lc_word ( sort keys %cases_found ) { print "$lc_word found with these cases: ", join( ', ', @{ $cases_found{ $lc_word } } ), "\n"; }
      Really a very simple and good example. Thanks a lot. I am
      working on it myself and studying all sort data structures.
      It will take some time for me. Once I will be able to crack
      it I will let you know. Many thanks once again
Re: howto accomodate multiple values
by holli (Abbot) on Dec 26, 2008 at 01:18 UTC
    Welcome back, ashnator.


    holli, /regexed monk/
    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.