I have a rather difficult task: figuring out some strange behavior when going through characters in Perl using a for
loop. This piece of code works as expected:
for (my $file = 'a'; $file le 'h'; $file++) { print $file; }
Output: abcdefgh
But when I try the loop through the characters back, like this:
for (my $file = 'h'; $file ge 'a'; $file--) { print $file; }
gives me the following as a result.
Output: h
Maybe the decrement operator does not behave the way I think it happens when using characters?
Does anyone have any ideas on this? I am very grateful for your help!
Hi,
Tommy
source share