in reply to Copy preserving attributes

I would like to copy files preserving attributes (something like cp -cdpP) within perl rather than using a system call to *nix 'cp'.

Calling cp is your best option. It can be done safely with multi-arg system

my $rv = system('cp', '-cdpP', ...); $rv == -1 and die("Can't execute cp: $!\n"); $rv & 0x7F and die("cp died from signal ", ($rv & 0x7F), "\n"); $rv >> 8 and die("Error ", ($rv >> 8), "from cp\n");