in reply to Re: Re: Hash of arrays
in thread Hash of arrays

Golf.......

do{split/: |;|\n/;$h{$_[0]}=[@_[1..$#_]]}for<DATA>

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: Re: Hash of arrays
by broquaint (Abbot) on Nov 04, 2002 at 14:47 UTC
    Four!
    %h=map{split/: |;|\n/;shift@_,[@_]}<DATA>;

    HTH

    _________
    broquaint

Re: Re: Re: Re: Hash of arrays
by strider corinth (Friar) on Nov 04, 2002 at 21:05 UTC
    Not quite as good as broquaint's score, but close:

    y/:;/ /,split,$i=shift@_,$h{$i}=[@_]for<DATA>;

    Points to anybody who can explain why $above_code =~ s/$i=shift@_,$h{$i}=/$h{shift()}=/ won't work the same as $above_code.
    --

    Love justice; desire mercy.
Re: Re: Re: Re: Hash of arrays
by jdporter (Paladin) on Nov 04, 2002 at 17:56 UTC
    Shioo.
    my %h = map { chomp; /:\s+/ ? ( $` => [split ';', $'] ) : () } <DATA>;
    Or, perhaps a little more comprehensible (but less safe):
    my %h = map { $_->[0] => [split ';', $_->[1]] } map { chomp; [split /:\s+/] } <DATA>;