in reply to silly question

Mmm, map: %args = map { split /=/ } @ARGV; Nondestructive, too!

Replies are listed 'Best First'.
RE: Re: silly question
by merlyn (Sage) on Apr 28, 2000 at 06:30 UTC
    Not entirely non-destructive. It's pretty damaging to %args. I'd suggest (although messy) if you wanted to keep the previous value of %args and merge in the new, you could do this:
    %args = (%args, map { split /=/ } @ARGV);
      I'm not sure whether this is better or worse. I suspect performance is better when %args is larger. If you're not interested in clobbering @_, use a temporary array. This won't win me any Perl golf either: map { @_ = split /=/; $args{$_[0]} = $_[1]; } @data;