in reply to Re (tilly) 1: grep instead of foreach?
in thread grep instead of foreach?

That is a cool writeup.

I have never seen this before:

my %sorted_index; @sorted_index{@sorted_array} = 0..$#sorted_array;
Can you explain to me how it works? Is it in the documentation?

-- iakobski

Replies are listed 'Best First'.
Re: Re: Re (tilly) 1: grep instead of foreach? - hash slices
by bjelli (Pilgrim) on May 22, 2001 at 14:41 UTC
    is using a hash-slice there. The idea is: to address more then one entry in the hash at once. a simple example:
    my %languages; $languages{'python'} = 'boring'; @languages{'perl', 'perl6'} = ('cool', 'real soon now'); # this is short for ( $languages{'perl'} , $languages{'perl6'} ) = ('cool', 'real soon now'); # or $languages{'perl'} = 'cool'; $languages{'perl6'} = 'real soon now';

    There are also array-slices.

    Read perlman:perldata

    --
    Brigitte    'I never met a chocolate I didnt like'    Jellinek
    http://www.horus.com/~bjelli/         http://perlwelt.horus.at