in reply to Using Win32::OLE 'Excel' and stumped

I'd try something like the following:
use File::Spec; # define variables as above opendir(CURRDIR, $mypath) or die "Can't open $mypath: $!"; my @files = map { File::Spec->catfile($mypath, $_) } grep { /^[\d\w\s]+\.$filetype/ } readdir CURRDIR; foreach my $file (@files) { # reveal potentially nasty leading/trailing whitespace print "Processing ->$file<-\n"; my $book = $Excel->Workbooks->Open($file) or die "Error opening $file: $!"; $book->Close(); }
This lets a tested, cross-platform module File::Spec handle the dirty business, avoids string interpolation that may be trouble, and is slightly more Perlish.

Replies are listed 'Best First'.
Re: Re: Using Win32::OLE 'Excel' and stumped
by cacharbe (Curate) on Apr 30, 2001 at 23:40 UTC
    Hrm... Never used File::Spec before. prettier. Still doesn't work, but it is still throwing the same error.

    *shrug*

    I have no idea what is going on. I'm sure it's string interpolation, but I can't find the root of it. Others are mentioning that it is working fine on their systems.

    Arrgh.

    Chuck