http://www.perlmonks.org?node_id=27305


in reply to Getting correct filename

I'm not totally clear on what you are trying to do but maybe something like this will get you started:

# $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");

If i totally missed what you were trying to do, let me know.

Good luck,
Mark