in reply to Filtering CGI Input

$sid !~ /0-9/ is true if the input does not contain the exact sequence "0-9". You probably want something like
$sid =~ /^\d{1,5}$/
(That also matches 000, etc, but presumably that's OK.)
chas