# $infile is assumed to be the file you are reading... # I'm assuming you know what you want to put in the out # file name and how to get it... my $otherinfo = &getotherinfo; # the \d{2} is the day, make it \d{1,2} if you want to # allow weblog.2Jul as well as weblog.23Jul # # the \w{3} catches the month abbreviation (my $outfile = $infile) =~ s/\.\d{2}\w{3}/-$otherinfo/; # do this if you want to use an absolute pathname... $outfile = $pathname . $outfile; open(OUTFILE, "> $outfile");