$my number =10; XXX Invalid syntax while($input=){ XXX Input a value that's never used. print"choose 1 or 2 \n"; XXX Extra space in prompt. $choice=(); XXX Improperly localized. Use 'my'. Error revealed using 'use strict'; if($choice=~/1/){ XXX Allows more than intended, such as 37612. &flashcard(); XXX Misleading use of "&". Get rid of it. else{ $choice=~/2/); XXX Allows more than intended, such as 37612. print"enter random range\n"; XXX Extra space in prompt. my $newrandom = (); &options($newrandom); XXX Misleading use of "&". Get rid of it. XXX Useless call to function since it has no side-effects and you discard the result. } } sub flashcard { my $random = int(rand(&options())); XXX Misleading use of "&". Get rid of it. XXX options() expects an argument. } sub options { my $max = shift; if ($max==10){ return 10; }else{ return $max; } } XXX Your code is unreadable throughout due to inconsistent and nearly non-existing indenting.