Archive for September, 2007

Perl

Saturday, September 15th, 2007

My *very* small collection of all things perl …

Perl string manipulation
There are two main forms for regex, and they are “match” and “substitute” and they look like this:

# Just match on a pattern.
m/pattern/;

and

# Match on pattern, and replace any matches found with ‘replacement’
s/pattern/replacement/;

(Strangely enough, the “m” stands for “match” and the “s” for “substitute”. :-)