You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
965 B
Plaintext

# perl
# The Perl 5 language interpreter.
# Parse and execute a Perl script:
perl script.pl
# Check syntax errors on a Perl script:
perl -c script.pl
# Parse and execute a perl statement:
perl -e perl_statement
# Import module before execution of a perl statement:
perl -Mmodule -e perl_statement
# Run a Perl script in debug mode, using perldebug:
perl -d script.pl
# Loo[p] over all lines of a file, editing them [i]n-place using a find/replace [e]xpression:
perl -p -i -e 's/find/replace/g' filename
# Run a find/replace expression on a file, saving the original file with a given extension:
perl -p -i'.old' -e 's/find/replace/g' filename
# See also:
# Perl language cheat sheets at /perl/
# list of pages: /perl/:list
# learn perl: /perl/:learn
# perl one-liners: /perl/1line
# search in pages: /perl/~keyword
# Perl method of listing out the environment variables, sans values.
perl -e 'print("$_\n") foreach keys(%ENV)'