use strict; use warnings; my $str = '6AG3_608_FGG_20100124_20120923418_20126254447_201262512026.txt'; $str =~ s/_\d{11,}//g; print $str, "\n";