Pirax has asked for the wisdom of the Perl Monks concerning the following question:
In perldoc's re pragma documentation - use re 'taint' section stands:
This feature is useful when regexp operations on tainted data aren't meant to extract safe substrings, but to perform other transformations.and additionaly:
...values returned by the m// operator in list context...So operation like this:
does not remove taint flag from $1 and $2 values. Everything as expected.my $var = $ARGV[0]; ## $var is tainted and has value 'aabb'; { use re 'taint'; $var =~ m/(aa)(bb)/; }
But similar operation:
removes taint flag from both $1 and $2 values.my $var = $ARGV[0]; ## $var is tainted and has value 'aabb'; { use re 'taint'; $var =~ s/(aa)(bb)/$1/; }
Shouldn't this produce the same result? I know documentation says "values returned by the m// operator" but...
Or maybe there is another way for s/// operator to behave like m// with use re 'taint'?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use re 'taint' with s/// operator
by BrowserUk (Patriarch) on Nov 19, 2010 at 13:29 UTC | |
by Pirax (Initiate) on Nov 19, 2010 at 14:42 UTC | |
by BrowserUk (Patriarch) on Nov 19, 2010 at 15:07 UTC | |
by JavaFan (Canon) on Nov 19, 2010 at 16:52 UTC | |
by BrowserUk (Patriarch) on Nov 19, 2010 at 17:02 UTC | |
by JavaFan (Canon) on Nov 19, 2010 at 19:08 UTC | |
by BrowserUk (Patriarch) on Nov 19, 2010 at 19:20 UTC | |
| |
|
Re: use re 'taint' with s/// operator
by Anonymous Monk on Nov 19, 2010 at 13:25 UTC |