M
Munnki
I am learning Perl and was using the Wrox Learning Perl book that I
found on the web. The author was explaining the autoincrement operator
and try as I might I can't understand this behaviour. The line of code
read...
$a = "9z"; print ++$a, "\n";
Aparently Perl reads in the ranges a-z, A-Z, 0-9 and if it caps off a
range then it will add a digit on the leftmost side and go back to the
beginning of a range ...but i think I misunderstand this as I was
expecting...
munnki@localhost:> 00a
to be output to the shell, as opposed to
munnki@localhost:> 10
i thought that the 9 will have reached it's max and become two zeros
(the start of the next range) and the z would, having reached it's
upper bound, have become an 'a'.
I hope I don't sound too stupid and I know this probably isn't the
most important aspect of the language..but i don't fully understand
this...could someone explain...
thanx
munnki
found on the web. The author was explaining the autoincrement operator
and try as I might I can't understand this behaviour. The line of code
read...
$a = "9z"; print ++$a, "\n";
Aparently Perl reads in the ranges a-z, A-Z, 0-9 and if it caps off a
range then it will add a digit on the leftmost side and go back to the
beginning of a range ...but i think I misunderstand this as I was
expecting...
munnki@localhost:> 00a
to be output to the shell, as opposed to
munnki@localhost:> 10
i thought that the 9 will have reached it's max and become two zeros
(the start of the next range) and the z would, having reached it's
upper bound, have become an 'a'.
I hope I don't sound too stupid and I know this probably isn't the
most important aspect of the language..but i don't fully understand
this...could someone explain...
thanx
munnki