rename() method renames a file in Perl.
currentName: This is the current file’s name.
newName: This is the new name we want to give the file.
The value returned is either
1 is returned if the process was successful, and
0 is returned if it was unsuccessful.
# rename files and print results print rename("main.perl", "app.perl"); print "\n"; print rename("test.txt", "newtest.txt");
rename()function and print the result. This is successful. Hence,
0because it was not successful.
View all Courses