Apart from the hint given in Re: Scripts work when run individually but not when run as one compiled script by GotToBTru - three points:
- You mix path delimiters.
sub csv_xlsx{
my $dir = "C:\\Temp\\Data";
foreach my $fp (glob("$dir/*.csv")) {
...
}
unlink glob "C:\\Temp\\Data\\*.csv" or warn $! ;
}
To avoid that, always use File::Spec for path operations.
- Did you check what those glob() expressions do return?
- What are you doing with @class_files ?
And a last hint - to format your indenting before posting, you can use Perl::Tidy, which expands tabs and sets the shift width to 4 spaces, given the proper rules for that. ;-)
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'