use warnings; use strict; if(! $ENV{TEST}) { $ENV{TEST}=1; exec {$^X} ($^X,$0); } while(my $input=) { chomp($input); last unless($input); print "You typed: \"$input\"\n"; } print "Exiting\n"; #### D:\test>perl test.pl D:\test>test1 'test1' is not recognized as an internal or external command, operable program or batch file. D:\test>test2 You typed: "test2" test3 'test3' is not recognized as an internal or external command, operable program or batch file. D:\test>test4 You typed: "test4" test5 'test5' is not recognized as an internal or external command, operable program or batch file. D:\test> Exiting #### ~/test$ perl test.pl test1 You typed: "test1" test2 You typed: "test2" test3 You typed: "test3" test4 You typed: "test4" test5 You typed: "test5" Exiting ~/test$