h3xx wrote:
I find it's easier (and in this case totally doable) if you make
something like this:

for my $count (10 .. 0) {

You can't do that in Perl. The range operator has to have the smaller number on the left and the larger number on the right otherwise it will return an empty list and the loop will not run.

The correct way is either:

for my $count ( reverse 0 .. 10 ) {

Or:

for ( my $count = 10; $count >= 0; --$count ) {


  printf STDERR "%2d seconds remaining...\n", $count;

You don't need printf() for that:

   print STDERR "$count seconds remaining...\n";


  sleep 1;
  print STDERR "\e[A";
}


John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to