in reply to /m pattern matching modifier
I think you understand ^ and $ just fine; if /m is in effect, there is where they can match:
"AAC\nGTT\n" ^ $$^ $$
But the regex only searches for the first match, and because the dot doesn't match the \n (it would only do that with /s), it goes from A to C. If you ask perl to do a second match, it will find GTT:
$ perl -wle 'print $& while "AAC\nGTT"=~/^.*$/mg;' AAC GTT
If you want to match the second line straight away, you can do something like this:
$ perl -wle '"AAC\nGTT"=~/.*^(.*)$/ms; print $1' GTT
|
|---|