use strict;
my $str = '0 @I10@ INDI
1 XXXX Alena /Boudová/
2 TYPE birth
2 GIVN Alena
2 SURN Bouda
1 SEX F
1 BIRT
2 DATE 1950
2 PLAC Dolní Lhota, Královéhradecký, Česko
3 _LOC @X866@
1 OCCU dělnice
1 FAMS @F187@
1 FAMC @F146@
1 CHAN
2 DATE 19 OCT 2015
3 TIME 20:29:06
2 _WT_USER admin
1 XXXX Alena /Kuklová/
2 TYPE married
2 GIVN Alena
2 SURN Kukl';
my $regex = qr/\n1 XXXX.*(\n[2-9].*)*/mp;
my $subst = '';
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