for (1,2) { my $data = prompt_user(); } sub prompt_user { print "Enter a number\n"; while () { # Do stuff } }