- or download this
rename "$file_in", "$random_num"."$file_in" or warn "Couldn't rename f
+ile: $!\n";
- or download this
if (-e $file_in) {
rename($file_in, "$file_in.$random_num");
}
- or download this
my $f = $file_in;
while (-e $f) {
$f = "$file_in." . int(rand(100000));
}
rename($file_in, $f);