Hi.
I'm new to perl, and I stumbled across a strange behavior in my for loop.
In the following code, the second for loop actually counts way passed
what I expected, and actually stops at "yz" and not "z" as expected.
As shown by the third for loop, incrementing the letters, seems to give
me the desired output in each loop.
What is going on here?
#!/usr/bin/perl
use warnings;
use strict;
my $letter = "u";
for ("u".."z"){
print " $_ ";
}
print "\n\n";
for ($_="u"; $_ le "z"; $_++){
print " $_ ";
}
print "\n\n";
for(1..7){
print " $letter ";
$letter++;
}
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/