2016-11-05 19:14:19 +00:00
|
|
|
# perl
|
|
|
|
|
|
|
|
> The Perl 5 language interpreter.
|
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
- Parse and execute a Perl script:
|
2016-11-05 19:14:19 +00:00
|
|
|
|
|
|
|
`perl {{script.pl}}`
|
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
- Check syntax errors on a Perl script:
|
2016-11-05 19:14:19 +00:00
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
`perl -c {{script.pl}}`
|
2016-11-05 19:14:19 +00:00
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
- Parse and execute a perl statement:
|
2016-11-05 19:14:19 +00:00
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
`perl -e {{perl_statement}}`
|
2016-11-05 19:14:19 +00:00
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
- Import module before execution of a perl statement:
|
2016-11-05 19:14:19 +00:00
|
|
|
|
|
|
|
`perl -M{{module}} -e {{perl_statement}}`
|
|
|
|
|
2016-11-05 19:17:40 +00:00
|
|
|
- Run a Perl script in debug mode, using `perldebug`:
|
2016-11-05 19:14:19 +00:00
|
|
|
|
|
|
|
`perl -d {{script.pl}}`
|
2017-04-15 16:48:00 +01:00
|
|
|
|
2017-04-22 14:40:57 +01:00
|
|
|
- Loo[p] over all lines of a file, editing them [i]n-place using a find/replace [e]xpression:
|
2017-04-15 16:48:00 +01:00
|
|
|
|
|
|
|
`perl -p -i -e 's/{{find}}/{{replace}}/g' {{filename}}`
|
|
|
|
|
2017-04-22 14:40:57 +01:00
|
|
|
- Run a find/replace expression on a file, saving the original file with a given extension:
|
2017-04-15 16:48:00 +01:00
|
|
|
|
|
|
|
`perl -p -i'.old' -e 's/{{find}}/{{replace}}/g' {{filename}}`
|