http://www.perlmonks.org?node_id=785632

vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Yesterday I was modifiying my code to get a file name from the given path, I used the split function and separated by '/' character then got only the file name from the path, for this I used the temporary array and got the file name by the

arrayname[$#arrayname]. The problem is the path may differ according to the report I save, So I do not know the exact position of the filename. If is now the filename position, I will use the,

$filename_save=(split '/', $file_path)[File_name_position],

So I get the file name without using the temp array, How to find the file name without using the temp array in split or any other easy way to find the filename only.

Update

Html tags were updated