in reply to fileparse(): need a valid pathname

#use strict;
Can you explain why you commented out this line? Not that this directly impacts your error condition, but it may give us more context.