Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hi!, i'm trying to taint this but it always gives me an error !
my $file = "//Administrator/Web Sites/Learning/myweek_$no.html"; if ($file =~ /^([-\@\w._:\/]+)$/) { $file = $1; # $data now untainted } else { print "Please report this error to the admin. Thanks"; ex +it; } open OUTPUT, ">$file.html"; print OUTPUT $template->output; close OUTPUT;
I'm trying to learn how to build my scripts in taing mode, but really having trouble here!?

thanks!

Replies are listed 'Best First'.
Re: tainting!
by Aristotle (Chancellor) on Mar 11, 2006 at 07:52 UTC

    Your path contains a space, but the pattern you use does not permit those.

    Btw, the explicit underscore in your character class is superfluous, since \w includes that anyway.

    Makeshifts last the longest.

Re: tainting!
by wfsp (Abbot) on Mar 11, 2006 at 07:54 UTC

    Your string has a space in it so you need to add a space to the regex.

    wfsp

    lag-- :-(