I am supposed to write a snipet of code for the following problem: The idea is to ask the user to provide a number (an initial number) and then have him providing numbers for as long as they are greater or equal to the previous ones.
I have written this:
print "Please give me a number:\n";
my $initial_number = <STDIN>;
print "Give me another number:\n";
my $new_number = <STDIN>;
print "Please continue with a new number:";
print "You specified a number which is smaller than the previous.
+The program will now exit\n";
but as you can see it only executes once...I think that I need a while loop, but I am not really sure on how to implement this.
Can you point me to the correct direction?