< Perl Programming < Keywords
The rename keyword
The rename function changes the file name given in OLDNAME. An existing file with the name of NEWNAME will be clobbered. Returns true on success and false otherwise.
The behaviour of the rename function varies widely, depending on the implementation on the operating system. It will often not work over file system boundaries, although mv on UNIX-like systems will sometimes work. Other restrictions may be whether it works on directories, open files, or pre-existing files.
Syntax
rename OLDNAME, NEWNAME
Examples
rename "barewords.pl" "bareword.pl"
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.