#!/usr/bin/perl use strict; use warnings; # 888985 while() { my $line = $_; if($line =~ m/<.*>([^>]+)<.*>/) { my $new = substr($line,0,10); print "THE NEW LINE is : $new\n"; print "capture only : $1\n"; # better to get the capture into a named var } # as soon as it's captured. } __DATA__ tove

now is the time
to deal with a line break.

#### THE NEW LINE is : capture only : tove THE NEW LINE is :

now is capture only : to deal with a line break.