in reply to Re: Negating a leading whitespace
in thread Negating a leading whitespace

I believe OP wants to check for the 2 chars _anywhere_ in the string, as long as the line doesn't start w/whitespace (so your second method)... I think this is easiest w/just two checks (i was having trouble making a single regex w/look-behinds):
if ( $line =~ /^\S/ && $line =~ /XY/ ){ ... }
Unless you can assume that the 2 chars will never be at the beginning of the line, in which case you can just do:
if ( $line =~ /^\S.*?XY/ ){ ... }