Here's the first part of the Cat and Otter Bistro script (see the WAP/WML chapter), where the variables are declared, and the $number variable is screened to make sure it's actually a number:
my $number = param('number');
my $smoke = param('smoke');
my $dinner_index = param('dinner_index');
$number =~ /([0-9]*)/ ;
$number = $1;
Here's the rest of the script, in case you're interested.