rename() function in Perl renames the old name of a file to a new name as given by the user.
Syntax: rename(old_file_path, new_file_path)
old_file_path: path of the old file along with its name
new_file_path: path of the new file along with its name
0 on failure and 1 on success
Running the Command:
Steps to Run the above code:
Step1: Create a file anywhere in your System and copy the File Path.
Step 2: Provide the path of your File in the code above and save it as .pl extension.
Step 3: Run the above code in Command line as perl Filename.pl.
Step 4: Name of the File is now changed with the new name provided.
- Perl | Basic Syntax of a Perl Program
- Perl Tutorial - Learn Perl With Examples
- Perl | split() Function
- Perl | chomp() Function
- Perl | chop() Function
- Perl | undef and the defined function
- Perl | cos() Function
- Perl | sin() Function
- Perl | abs() function
- Perl | atan2() Function
- Perl | splice() - The Versatile Function
- Perl | delete() Function
- Perl | defined() Function
- Perl | each() Function
- Perl | index() Function
- Perl | int() function
- Perl | join() Function
- Perl | keys() Function
- Perl | lc() Function for Lower Case Conversion
- Perl | lcfirst() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.