in reply to Re: Getting element of array with a match
in thread Getting element of array with a match
The thing that bugs me most about that snippet is the match-chomp-split sequence. I prefer:
my $id = 1006; my $answer; for (@data) { last if ($answer) = /^\Q$id\E\s*,(.*)/o; }
— Arien
Update: Added /o and allowed for optional whitespace between id and comma per tachyon's worries below.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Getting element of array with a match
by tachyon (Chancellor) on Dec 24, 2002 at 04:40 UTC | |
by Arien (Pilgrim) on Dec 24, 2002 at 05:04 UTC | |
by tachyon (Chancellor) on Dec 24, 2002 at 05:18 UTC |