until ($odometer[$wheel] < 9 || $wheel < 0)

#### use strict; use warnings; my @odometer = qw(0 0); for (1..$ARGV[0]) { print "was: @odometer\t"; @odometer = increment_odometer(@odometer); @odometer ? (print join ' ', @odometer) : (print "No more Wheels to turn! $!" and exit) ; print "\n"; } sub increment_odometer { my @odometer = @_; my $wheel = $#odometer; # start at rightmost wheel until ($odometer[$wheel] < 9 || $wheel < 0) { $odometer[$wheel] = 0; $wheel--; # next wheel to the left } if ($wheel < 0) { return; # fell off the left end; no more sequences } else { $odometer[$wheel]++; # this wheel now turns one notch return @odometer; } } #### until ($odometer[$wheel] < 9 || $wheel < 0) #ok original #negated direct form also ok while ( !($odometer[$wheel] < 9 || $wheel < 0) ) while ($odometer[$wheel] > 9 || $wheel < 0) # NO while ($odometer[$wheel] > 8 || $wheel < 0) # OK but NOT for greter than limit of the odometer! #Use of uninitialized value in numeric eq (==) at C:\SCRIPTS\odometer.pl line 27. #Modification of non-creatable array value attempted, subscript -3 at C:\SCRIPTS\odometer.pl line 26. #getting: 9 9-> while ($odometer[$wheel] == 9 || $wheel < 0) # OK but NOT for greter than limit of the odometer! #Use of uninitialized value in numeric eq (==) at C:\SCRIPTS\odometer.pl line 27. #Modification of non-creatable array value attempted, subscript -3 at C:\SCRIPTS\odometer.pl line 26. #getting: 9 9-> while ($odometer[$wheel] == 9 && $wheel >= 0) # OK