Hi,

trying to figure out what `last' actually does, I wrote this test
script:


use strict;
use warnings;
use autodie;

my $counter = 0;

while($counter < 8) {
    last if($counter > 2) {
        print "if: " . $counter . "\n";
    }
    else {
        print "else: " . $counter . "\n";
    }
    $counter++;
}


Unfortunately, that gives syntax errors.  I would expect the following
output:


else: 0
else: 1
else: 2
if: 3


What's wrong with that (letting aside that it is terribly ambiguous)?


-- 
"Object-oriented programming languages aren't completely convinced that
you should be allowed to do anything with functions."
http://www.joelonsoftware.com/items/2006/08/01.html

-- 
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