Created
November 29, 2012 09:58
-
-
Save davorg/4167915 to your computer and use it in GitHub Desktop.
Copy file contents to new file named using timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Time::Piece; | |
my $src_file = 'ABC.txt'; | |
my $t = localtime; | |
open my $in_fh, '<', $src_file | |
or die "Can't open $src_file for reading: $!\n"; | |
open my $out_fh, '>', 'ABC-' . $t->strftime('%m.%d.%Y-%T') . '.txt'; | |
print $out_fh $_ while <$in_fh>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment