in reply to Any tips on this?

An infinite while loop will work:
use warnings; use strict; print "Please give me a number:\n"; my $initial_number = <STDIN>; chomp $initial_number; while (1) { print "Please continue with a new number:"; my $new_number = <STDIN>; chomp $new_number; if ($new_number < $initial_number) { print "You specified a number which is smaller than the previo +us. The program will now exit\n"; exit; } $initial_number = $new_number; }

Replies are listed 'Best First'.
Re^2: Any tips on this?
by Anonymous Monk on Feb 04, 2014 at 17:58 UTC
    And the last statement will exit (I believe ...) from that loop. The next statement will branch back to the start of the loop again. As long as there is eventually some way out of the loop, an infinite loop is sometimes perfect perfect perfect perfect perfect perfect perfect perfect perfect perfect.
      Ah, thanks to all of you for your suggestions!