in reply to Creating Filenames using variables
#!/usr/bin/perl -w use strict; my @files=qw(blah.doc.doc blah.doc.txt blah.doc); my ($d, $m, $y) = (localtime)[3 .. 5]; ++$m; $y += 1900; my $date = "$m$d$y"; foreach (@files){ s/(.*)(\..*)/$1_$date$2/; print "$_\n"; }
|
|---|