for my $i(@contents) { if ( -f "$from/$i" ) { copy("$from/$i","$to/$i"); } }