setting locales:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:en",
...
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales
vi ~/.bashrc
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8

generate these locales manually reconfigure locales

sudo locale-gen "en_US.UTF-8"
sudo locale-gen "it_IT.UTF-8"
sudo dpkg-reconfigure locales

as a system tool

Perl works in MacOS,Windows and Linux

replace tabs with spaces

perl -pie 's/\t/    /g'  /var/www/file.txt
# grep lines
perl -lne 'print $1 if /(\w+ear)/' some.txt
 
# substitute
perl -lpe 's/Microsoft/Micro\$\$\$oft/g' some.txt
# multiple file replace
find . -type f -exec perl  -pie 's/something/another/g' {} \;
 
# file to upper
perl -pie ''tr/[a-z]/[A-Z]/'' sample.txt

side-effects

the magic argument, $_, which means "the return value of the previous call." It gets used and/or changed by many of the core library functions, implicitly.

this gives Perl the distinction of being the only language where one global side-effect is considered a core feature.

#!/usr/bin/perl
map(
    ($r=$_,
        map(
            (
                $y=$r-$_/3,
                $l[24-$r] .= (' ','@')[$y**2-20*$y+($_**2)/3<0]
            ),
            (0..30)
        ),
    ),
    (0..24)
);
print join("\n", map(reverse($_).$_, @l) ), "\n";