Perl dump

CPAN

perl -MCPAN -e shell

Arrays and hashes

Convert arrays to hashes

@$hash {@array_a} = @array_b;

sed and perl replacement on the commandline

perl -p -i -e 's/SEARCH/REPLACE/g' FILE
ls | xargs perl -pi -e 's/SEARCH/REPLACE/g'
grep -lir REGEXP * | xargs perl -pi -e 's/SEARCH/REPLACE/g'
perl -p -iEXT -e 's/SEARCH/REPLACE/g'
cat X | perl -p -e 's/SEARCH/REPLACE/gi'

If necessary add -w to perl command.

sed -r -e 's/SEARCH/REPLACE/'
sed -r -e 's#SEARCH#REPLACE#'
sed -i -e 's/SEARCH1/REPLACE1/g' -e 's/SEARCH2/REPLACE2/g' FILE
linux/perl.txt · Last modified: 2008/03/10 16:58 (external edit)
GNU Free Documentation License 1.2
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0