in reply to Function to replace a old file with newer version

Perl-only solution:

#!/usr/bin/perl -w use strict; ${^WIN32_SLOPPY_STAT}++; # Speed up the 'stat' call on Windows if ((stat "/tmp/A")[9] > (stat "/tmp/B")[9]){ # Compare mtime stamps print "A is newer than B; discarding B.\n"; unlink "B" or die "B: $!\n"; } else { print "B is newer than A; replacing A.\n"; unlink "A" or die "A: $!\n"; rename "B", "A" or die "Copying B->A: $!\n"; }

--
"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf