Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL rename Function
Syntax
Definition and Usage
Renames the file with OLDNAME to NEWNAME. Uses the system function rename( ), and so it will not rename files across file systems or volumes. If you want to copy or move a file, use the copy or move command supplied in the File::Copy module.
Return Value
0 on failure
1 on success
Example
Try out following example: First create test file in /tmp directory and then use following code to change file name.
#!/usr/bin/perl -w
rename("/tmp/test", "/tmp/test2") || die ( "Error in renaming" );
|
|

|
|
|