# loop until I get a null input while(1){ print "Type in a nubmer: "; my $x=<>; exit 0 unless $x # rest of the code here }