in reply to Regex question - either starts, or has newline prefixing?

I believe you want ^ with the m modifier.
while ("abc\ndef\nghi" =~ /^(.)/mg) { print("$1\n"); # a,d,g }