for (split(/\n/, $records)) { # do whatever with data now in $_ }