in reply to Match whitespace or start-of-string with lookbehind

I think this does what you're after for this:

$text =~ s/(?: (?<=\s) | (?<=\A) ) " (?=\w) /“/gx;
(update, I think etcshadow's answer is better in this case, though the non-capture |'d lookbehind is useful sometimes) (update 2: yikes, I don't know how I missed ysth's post, sorry for the duplication.)