13.2 Renaming a File
In the command shell, you change the name of a file with the
rename
command. And so it is with Perl, too, where this operation is denoted with
rename("fred","barney") || die "Can't rename fred to barney: $!";
Like most other functions, the
The
The
move
command performs a little behind-the-scenes magic to create a full pathname when you say
move file some-directory
. However, the rename("
Note that in Perl we had to say the name of the file within the new
directory explicitly. If you try to rename a file to a filename that already exists, |
|