##
if ( $contents =~ /^line3/mo ) {
if ( $contents =~ /^line2-(\w*)/mo ) {
print $1; # has to be changed as well
}
}
####
my $string = "abcde abcde adcde";
while ($string =~ /cd/og) {
print "pos = ", pos $string, "\n";
if ($string =~ /a(.)/ocg) {
print "a$1 matched at ",pos $string, "\n";
}
}