in reply to Regex question - either starts, or has newline prefixing?
while ("abc\ndef\nghi" =~ /^(.)/mg) { print("$1\n"); # a,d,g } [download]