in reply to How the auto-increment operator works?

Please use [...] for linking like [https://perldoc.perl.org/5.32.0/perlop.html#Auto-increment-and-Auto-decrement] for https://perldoc.perl.org/5.32.0/perlop.html#Auto-increment-and-Auto-decrement

Perl allows ranges of numbers and ranges of characters and a mix of both.

This affects multiple operators, not only ++

One use-case was uniquely naming log files and characters need far less space than numbers.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

UPDATE

°) the "EDIT" button will help you edit your post.

You can also use [doc://...] for documentation [doc://perlop] -> perlop

see also What shortcuts can I use for linking to other information?

Replies are listed 'Best First'.
Re^2: How the auto-increment operator works?
by zapdos (Sexton) on Aug 01, 2020 at 18:51 UTC
    Please, why my $foo = "Zz"; print ++$foo; prints "AAa" and not "Aaa"?

    And why $my foo = "c9"; print ++$foo; prints "d0" and not "c10"?

      Looks like you have three groups of symbols - digits , lower and uppercase characters - and every position stays within its group.

      If a new position is needed it'll adjust to the leftmost group.

      This makes sense to me, because the structure of a log_89ABCacd.txt file will always look the same, with only the numbers growing.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        if I do my $foo = "Be"; print ++$foo; it prints "Bf".

        But if I do my $foo = "Bz"; print ++$foo; it prints "Ca". I'm not getting this at all.