View Full Version : Resolved regex for cleaning $cgi-Vars;

06-07-2009, 01:31 AM

If anyone finds my brain please return it. It has definately gone awol. fyi, my if statement used to be an unless and so the error message was saying the opposite of what it should have

I am trying to ensure that the $params{$key} value includes only numbers and the \0 separator. I can't seem to get my regex to do it. There will be an indeterminate number of values and so also, an indeterminate number of \0.

foreach my $key (sort %params ) # loop through all sent params and show the completed form with errors
if ($key =~ /set_value/ && $params{$key} =~ /[0-9]+(\0)+/ )
{ # clean the params and values passed to this sub.

@values = split(/\0/, $params{$key} );

print qq( params{key}=$params{$key} );

print qq( <p>You have entered some invalid data causing this process to be terminated</p>);

The process error message always shows up. what should I be doing?