in reply to Re: Return Question in Subroutine
in thread Return Question in Subroutine

Hi,
I do have warning, strict all that turned on, but someone here don't like to see in the error logs the use of unnitialized errors on it, this sub checks the input from a form like this, simply:
my $test = filter(param( 'name' ));

I still think that a sub like that shouldn't offer anymore options other than check for bad characters trying to make into the application.

Replies are listed 'Best First'.
Re^3: Return Question in Subroutine
by GrandFather (Saint) on Apr 28, 2006 at 13:18 UTC

    You can probably clean up your cleanup code a little like this:

    use strict; use warnings; my $str = "<some> text with';*()/? nasty chars. scripted should be ok, + but not script"; print cleanup($str); sub cleanup { $_[0]=~tr|<>;()"'?/*||d; $_[0]=~s/\bscript\b//g; return $_[0]; }

    Prints:

    some text with nasty chars. scripted should be ok, but not

    DWIM is Perl's answer to Gödel