$my number =10; while($input=){ print"choose 1 or 2 \n"; $choice=(); if($choice=~/1/){ &flashcard(); else{ $choice=~/2/); print"enter random range\n"; my $newrandom = (); &options($newrandom); } } sub flashcard { my $random = int(rand(&options())); } sub options { my $max = shift; if ($max==10){ return 10; }else{ return $max; } }