in reply to How to remove the $1 hard coding
but it is strongly discouraged (forget about it immediately), and won't even work under strict (that's the reason for the no strict 'refs';). Fletch's answer provides a much better solution, to which I could just add that you can avoid copying the matches to an array, if you treat the return values of the match as a list:{ no strict 'refs'; $somestring =~ m/\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*/; $result = ${$matchnum}; }
should work fine.push @sps, (m/\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*/)[$columnNumber];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to remove the $1 hard coding
by hardburn (Abbot) on Aug 22, 2003 at 16:44 UTC | |
by shenme (Priest) on Aug 22, 2003 at 21:26 UTC |