#!/usr/bin/perl #subs.plx use warnings; use strict; #An incorrectly ordered list to have the user organise $_ = "Three, Four, One, Two"; print ("\t\tCounting Program\n\n", $_, "\n\n"); my $correct; print "Is this sequence correct?(yes/no)\n"; $correct = ; chomp ($correct); while ($correct ne "yes"){ print "Is the first number correct?\n"; my $first = ; chomp ($first); if ($first ne "yes"){ print"What should it be?\n"; $first = ; chomp ($first); } print "Is the second number correct?\n"; my $second = ; chomp ($second); if ($second ne "yes"){ print"What should it be?\n"; $second = ; chomp ($second); } print "Is the third number correct?\n"; my $third = ; chomp ($third); if ($third ne "yes"){ print"What should it be?\n"; $third = ; chomp ($third); } print "Is the fourth number correct?\n"; my $fourth = ; chomp ($fourth); if ($fourth ne "yes"){ print"What should it be?\n"; $fourth = ; chomp ($fourth); } #My RegExp /([A-Z][a-z][.][\b])/; #The substitutions based on my RegExp s/$1/$first/; s/$2/$second/; s/$3/$third/; s/$4/$fourth/; #Final print reads:FourThreeTwoOne, Three, Four, One, Two print ($_, "\n\n"); print "Is this sequence correct now?(yes/no)\n"; $correct = ; chomp ($correct); }