#!/usr/bin/perl
use strict;
use warnings;
open(my $in, '<', 'out2.txt')
or die "Cannot open input.txt: $!";
open(my $out, '>', 'out2_mod.sp')
or die "Cannot open output.txt: $!";
while (<$in>) {
print $out $_ unless /XXXXX/;
}
close($in);
close($out);
####
PPPPP
XXXXX is my name
YYYYY
KKKKK
UUUUU
BBBBB
CCCCCC
XXXXX is what I play
KKKKK
NNNNN
##
##
KKKKK
UUUUU
BBBBB
NNNNN