in reply to Re: using basename on a list of filesnames
in thread using basename on a list of filesnames

How is it correct usage to pass a list of filenames?! Only the first is handled as a filename; the rest are possible suffix matches.

From the doc:

$basename = basename($fullname,@suffixlist);

$ perl -MFile::Basename -wE 'say basename("foo.psd","bar.psd",".psd")' foo


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^3: using basename on a list of filesnames
by jcb (Parson) on Nov 14, 2019 at 00:35 UTC

    You are right. I had misread the code because passing the entire list a loop is iterating over instead of the current item is not a mistake I have ever made.

    The change I suggested is still needed, since our questioner is currently iterating over a list, but only passing a single value to his output routine.