in reply to Is there an array for $1,$2,$3... or some alternative ?
Evaluating a match operator in list context will return a list of the contents of the match's captures. Example:
my $string = 'abcde'; my @captures = $string =~ m/.(.)(.)(.)./; print "$_\n" for @captures; __END__ b c d
What I think you're attempting to construct is a symbolic reference named by user input. That's a bad idea, as the user could access any global variable in your program, intentionally or unintentionally. Just capture into an array as demonstrated above.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is there an array for $1,$2,$3... or some alternative ?
by palkia (Monk) on Mar 14, 2012 at 04:57 UTC |