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


in reply to Reusing a Parse::CSV module

Presuming that you just pass two filenames, one after the other, to your sub, your code works for me as is.

But I don't see any error checking. Maybe the scond file doesn't exist, or you've misspelt its name?

Change the second line in your sub to:

my $parser = Parse::CSV->new( file => $file ) or die Parse::CSV->errstr;