In general when you want to vary the name of a variable it's a sign you probably want an array or hash instead.
my @res = m/\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*/ ; push @sps, $res[ $columnNumber ];
Update: As flounder99 notes (in the wrong direction :) you might need to adjust $columnNumber down by one to get the right index it starts at one rather than zero.
In reply to Re: How to remove the $1 hard coding
by Fletch
in thread How to remove the $1 hard coding
by abhishes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |