use strict;
my $str = '№;Задача;T;O;P
;2016-01-18
1. ;task1;03:00;.;
;2016-01-18
2. ;task2;03:00;.;
;2016-01-18
3. ;task3;03:00;.;
;2016-01-19
7. ;33333;03:00;.;
;2016-01-19
8. ;d;03:00;.;
;2016-01-19
9. ;00;03:00;.;
;2016-01-20
21. ;task1;03:00;.;
;2016-01-20
22. ;task2;03:00;.;
;2016-01-21
25. ;testtime;03:00;.;
;2016-01-21
26. ;fgghgfh;23:45;.;, new t.';
my $regex = qr/(?<=(;\d{4}-\d\d-\d\d\n))((?:[^;]++|;)*?)\1/p;
my $subst = '\\2';
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