That doesn't work, because you're changing the context of =~ from scalar to list. while ($record->{data} =~/(.*)\n/g) { my $line = $1; would be the equivalent without the chomp.
However, neither solution will always work with Windows text files. See my reply to this post's grandparent.
In reply to Re^3: using a variable as a filehandle
by ikegami
in thread using a variable as a filehandle
by bear0053
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |