Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
... my $attach = "file.png"; my @fh = split(/\\/, $attach); my $last_elmnt = @fh; my $filename = $fh[$last_elmnt-1]; my $tempfile = "tempdir/$filename"; my $new_filename = "allfiles.png"; open( ATTA, ">$tempfile" ) || die "Can't open $tempfile: $!"; binmode ATTA; while ( <$attach> ) { rename $tempfile, "tempdir/".$new_filename or die "Cannot rename f +ile: $!"; } print ATTA; } close ATTA; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File "rename" error in renaming a file.
by GrandFather (Saint) on Oct 11, 2022 at 20:54 UTC | |
|
Re: File "rename" error in renaming a file.
by Marshall (Canon) on Oct 11, 2022 at 20:23 UTC | |
|
Re: File "rename" error in renaming a file.
by hv (Prior) on Oct 11, 2022 at 19:59 UTC | |
by Anonymous Monk on Oct 11, 2022 at 20:14 UTC |