Index Micro HowTos
index of all micro how-tos Userland |
|
Wednesday, 07 March 2007 |
|
|
|
Perl |
|
|
|
|
|
|
|
|
|
|
|
Set up CPAN
perl -MCPAN -e shell
Find modules currently installed
find `perl -e 'print "@INC"'` -name '*.pm' -print
Taint mode
For untrusted scripts, add -T flag to perl at the start
of the script:
#!/usr/local/bin/perl -T
One liner to edit files in place
This command edits a group of files in place. In particular,
it does a global search/replace. The -p switch
tells perl to iterate over filename arguments, -i
tells perl to edit files in place, and -e indicates
that a one line program follows.
perl -p -i -e 's/248/949/g' *.txt
One liner to edit files in place and backup each one to filename.old
perl -p -i.old -e 's/248/949/g' *.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|