Special characters like "/" ... prefix with "\", e.g. if $str =~ /<\/A>/ {... } to find lines with "</A>"
if ($var =~ /someExpression/
)
{
print "before match is >$`<\n";
print
"matched is >$&<\n";
print
"after match is >$'<\n";
}
if ($var =~ /(part1)(part2)...(partN)/
)
{
print
"first part of match is >$1<\n";
print
"next part is >$2<\n";
etc.
}
Also, re above
$var =~ s/(part1)(part2)/\2\1/; #reverses position of part1 and part2
\d \D [0-9] [^0-9]
\b \B start or end of a "word"
\s \S white space, all excep carriage return
\w \W "word" & not word
/^expression/
- at start of line
/expression$/ - at end of a line
A{5,10}, a{,10}, x{5,}
[0-9]
[0-9a-z]
[0-9a-z+-_]
a* a? a+ (abc)*
@list = split(/delimiter/,$line);
$line = join("delimiter",@list);
$line = join($glue,@list);
if $line =~ /matcher/i; # ignore case of letters
if $line =~ /$var/i;
$line =~ s/findThis/ReplaceWithThis/;
$line =~ s/findThis/ReplaceWithThis/g; #global
$line =~ s/findThis/ReplaceWithThis/i;
#ignore case
$line =~ s/findThis/ReplaceWithThis/gI; #global
& ignore case
if ($birds =~ /songbird|bluebird|redbird/)