in reply to Multi Line Regex Matches...

You may prefer this line-by-line approach:
C:\Users\Bill\forums\monks>type tj999.pl use strict; use warnings; open my $INFILE, '<', \<< 'END_INFILE'; 123,-->456, 456,-->234, 234,-->789, 789,-->123, END_INFILE my $old_line = <$INFILE>; while (my$new_line = <$INFILE>) { my $sample = $old_line.$new_line; $sample =~ /^(\d{3}).*(\d{3})\,\s*$/s; print "$1,-->$2\n"; $old_line = $new_line } C:\Users\Bill\forums\monks>perl tj999.pl 123,-->234 456,-->789 234,-->123
Bill

Replies are listed 'Best First'.
Re^2: Multi Line Regex Matches...
by tj999 (Novice) on Sep 03, 2017 at 18:22 UTC

    Thank you all so much for your help!

    I really appreciate the info, you have all given me a lot to work with.

    THANK YOU EVERYONE!!!