in reply to Hash asignement with RE and map()

my %hash = map { /(ID)(name)(email)(title)(date)(...)/ && do { ($1, [$ +2, $3, $4, $5, ...]) } } @lines; # or, equivalently: my %hash = map { ($1, [$2, $3, $4, $5, ...]) if(/(ID)(name)(email)(tit +le)(date)(...)/ } @lines;

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.

Replies are listed 'Best First'.
Re: (bbfu) Re: Hash asignement with RE and map()
by MeowChow (Vicar) on Jul 04, 2001 at 07:28 UTC
    I would be inclined to write it as follows, so as to avoid the explicit enumeration of match groups:
    my %hash = map { shift @$_ => [ @$_ ] } map [ /(ID)(name)(email)(title)(date)(...)/ ], @lines;
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print