Once after listing all the filenames, i need validate each of the filenames should note exceed 8 characters. If files names which is having 8 characters and less than 8 characters i need to remove last charecter from each of the file names and prefix it with character "A"
All the filenames having .doc extention,below are the sample files names in a folder.

Please advice me, which perl fucntion i need to use in order to remove last charecters from the filename if it is having 8 characters and prefix the filename with character "A" For the filenames which is having less than 8 charecters i just need to prefix "A" to each without removing last character.

Comment on
I have a folder which is having 1200 files,all the file names are have maximum of 8 character length.I need to remove last character from each of the filnames and prefix it with character "A"
Select or Download Code

Capture up to 7 symbols, then have an optional single symbol, then capture a literal dot and up to three more characters. Then rename the file to 'A' . $1 . $2

The last step is to realize that things have gone horribly wrong with your requirements as stated, when you notice that you are not guaranteed to have unique filenames after losing the last letter, and files start conflicting with each other.

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other