in reply to Using Win32::OLE 'Excel' and stumped
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.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(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using Win32::OLE 'Excel' and stumped
by cacharbe (Curate) on Apr 30, 2001 at 23:40 UTC |