I used to use the pos($foo) = pos($foo) trick until Klaus Weidner pointed out to me in a patch to Text::xSV the useful fact that using the obscurely documented /c modifier keeps the flag from being set in the first place. In addition to being cleaner this fixed a segfault on long strings due to an internal Perl bug.