Brian Raven wrote:
>>$filemask = glob ( @ARGV ); # Example: c:\ftp\test*
>
> Its better to declare and initialise variables at the same time, rather
> than declaring a bunch and then initialising them.
Saves a line of code anyway.
> Also, why are you
> calling glob if you are using Win32::Autoglob?
Better question is why use autoglob ? It defeats the purpose of
$filemask. Drop the autoglob and do the globbing yourself below.
If there can be more than one filemassk, you'd also want that to
be @filemask instead of $filemask.
>>foreach my $filemask (@ARGV){
@ARGV should have been emptied into @filemasks using my method or
the global $filemask was unecessary using this method. Assuming
that @filemasks already has the masks from above, you could use
something like:
my @myfile;
push @myfile, glob $_ foreach (@filemasks);
Note that full or relative paths could be in @myfile, so you may
want to process the masks one at a time and remotely cd to the
proper relative dir and remove the path component.
>>#print "$filemask\n";
>>$command = "dir $filemask /b";
>>$command2 = $command . "\n";
>>@myfile = `$command2`;
>
> my @myfile = `dir $filemask /b` would have done, or possibly my @myfile
> = <$filemask>. Also, its not clear why you are even doing this if you
> are using Win32::Autoglob.
Autoglob shouldn't be used if masks are wanted.
Hopefully, me comments amongst Brian's comments can be sorted out.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs