# File: countGoto.pl # Title: Counts up to a set number (with GOTO) # Author: Mihaela Malita # What number would you like to count to? 10 # 1 2 3 4 5 6 7 8 9 10 # More(y/n)? y # What number would you like to count to? 5 # 1 2 3 4 5 # ... LABEL: # this is a label in your code for goto print "What number would you like to count to? "; $n = ; chop($N); for (1..$n ) { print "$_\t"; # $_ is the default counter variable and \t is TAB } print "\nMore(y/n)? "; $a = ; chop($a); if ($a eq 'Y' or $a eq 'y') # type y or Y { goto LABEL; } # jumps to the marker called LABEL: print 'Bye'; exit;