my $filename = "customer100"; my $timestamp= "02012013"; $filename =~ /(\w+)(\d+)/; # split filename into "customer" and "100" $filename = $1."_".$timestamp."_".$2;