use strict; use warnings; use v5.14; while (1) { my $current = shift @ARGV; say $current; push @ARGV, $current; say "Hit return or enter 0 to exit"; chomp (my $input = ); last if $input eq "0"; } exit 0; #### $ perl test_argv.pl one two three one Hit return or enter 0 to exit two Hit return or enter 0 to exit three Hit return or enter 0 to exit one Hit return or enter 0 to exit two Hit return or enter 0 to exit three Hit return or enter 0 to exit one Hit return or enter 0 to exit two Hit return or enter 0 to exit three Hit return or enter 0 to exit 0