Hi,
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>;
chomp $initial_number;
print "Give me another number:\n";
my $new_number = <STDIN>;
if($new_number>=$initial_number)
{
print "Please continue with a new number:";
}
else
{
print "You specified a number which is smaller than the previous.
+The program will now exit\n";
exit;
}
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?