http://www.perlmonks.org?node_id=605251


in reply to Checking to see if Taint mode is enabled

${^TAINT}

Reflects if taint mode is on or off. 1 for on (the program was run with -T), 0 for off, -1 when only taint warnings are enabled (i.e. with -t or -TU).

In Perl 5.8.
  • Comment on Re: Checking to see if Taint mode is enabled

Replies are listed 'Best First'.
Re^2: Checking to see if Taint mode is enabled
by Burak (Chaplain) on Mar 17, 2007 at 12:23 UTC
    You have to use that new global inside an eval for backwards compatibility:
    sub is_tainted { my $taint; if ( $] >= 5.008 ) { $taint = eval '${^TAINT}'; } else { # some work around ... } $taint; }