in reply to Duplicating the 'cp' command's '-u' switch

Here,

use File::Copy; sub ucopy { @_ == 2 or die 'sub ucopy needs two arguments.'; -e $_[1] and (stat $_[1])[9] > (stat $_[0])[9] and return 1; copy @_; }
The first statement in the sub checks for the proper number of arguments. The second returns success without doing anything if the target exists and is newer than the source (by mtime). If that didn't happen, &File::Copy::copy is called on the arguments and its result returned.

After Compline,
Zaxo