in reply to File open problem with "GLOB"

unlink ($input);

What's that suppose to do? It doesn't look like $input holds a file name. Perhaps you meant

undef ($input);

but that's totally useless since the variable is destroyed when the scope ends at the end of the script, the next line.

Another consideration is that split(',', ...) is misleading since the first argument must be a regexp. I prefer always specifying a regexp: split(/,/, ...).

Finally,
my $ts;
foreach $ts (...) { ... }
can be written as simply
foreach my $ts (...) { ... }

Replies are listed 'Best First'.
Re^2: File open problem with "GLOB"
by mcoblentz (Scribe) on Mar 16, 2008 at 06:33 UTC
    ikegami, thanks for the replies and suggestions. They worked very well, thank you. I changed the split(',', ...) statement per your suggestion. Also I deleted the  unlink/undef lines because that was an artifact from the example I borrowed. I think it was originally intended to close down an input file handle if the user supplied one in the options - I don't need that.

      For future reference, closing file handles is done with close, not unlink. Using undef or letting the variable go out of scope both do the trick as well.

      I use the last option. I don't remember ever having to explicitly close a file handle in Perl.