use strict;
my $str = '167
00:06:59,794 --> 00:07:01,379
Well, I would like to see
your face as soon as possible.
168
00:07:01,421 --> 00:07:03,048
Really?
- If that\'s possible, yeah.
169
00:07:03,089 --> 00:07:04,007
- Really?
- Mm-hmm.
170
00:07:04,049 --> 00:07:05,550
I wanna see your face.
- Okay.
171
00:07:05,592 --> 00:07:07,427
Let\'s just order so we can get
the business out of the way,';
my $regex = qr/^([A-Z])(?=.*\r?\n-)/mp;
my $subst = '- $1';
my $result = $str =~ s/$regex/$subst/rg;
print "The result of the substitution is' $result\n";
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html