This puzzled me the last 15 minutes:
if ('ab' =~ /^a|b$/) { print 't' } else { print 'f' }
print "\n";
I have expected that 'a' or 'b' following the beginning and followed by the end, should match only one character. So the test should fail for two characters 'ab'. But it succeeds. Why?