πŸ“˜ Postfix operator - - in Perl 6

πŸ“˜ Postfix operator - - in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.


- - is a postfix decrement.

Both postfix and prefix operators magically know how to deal with numbers in filenames.

my $filename = 'file01.txt';
for 1..10 {
Β Β Β  say $filename++;
}

This example prints the list of the filenames with incrementing numbers: file01.txt, file02.txt, … file10.txt.

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code