use strict; use warnings; local $/= "\n="; while (my $line = ) { print "\n------------------------------\n"; if ($line =~ m/Primary \(Reporting\) Cp\s*:\s*((?:(?!Set).)*)Set\s*:\s*((?:(?!Car).)*)Car\s*:\s*((?:(?!Ref).)*)/si) { print "Cp:$1 - Set:$2 - Car:$3"; } if ($line =~ m/Phase\s*:\s*((?:(?!Strength).)*)Strength\s*:\s*((?:(?!\n).)*)/si) { print "\nPhase:$1 - Strength:$2\n"; } while ($line =~ m/(?