in reply to regex search

To ask "does $A start with $B" is trivial:

$A =~ /^${B}/;

But what is the complement of this? That is, "is $B a prefix of $A?"

In my understanding of English, those don't complement each other; they mean the same thing. A "prefix" is a group of letters at the beginning of a word, so if $B is a prefix of $A, then $A starts with $B. Your line of code above tests for that situation, whichever you call it.

Aaron B.
Available for small or large Perl jobs; see my home node.