$Bill Luebkert <> wrote:
> 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.

Absolutely :)

> 
>>                                                     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. 

Any one of the three methods used in the OP's script to expand a
filename pattern would have been adequate (if used correctly), including
Autoglob.

> 
>>> 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);

This is pretty much what Autoglob does.

> 
> 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.  

I had considered raising that issue, but I was concerned that in trying
to address all of the potential problems with the OP's script I was
starting to write an essay. There is also the potential problem of how
to handle files with the same name in different directories on the local
box, for example.

> 
>>> #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.

HTH

-- 
Brian Raven 

_________________________________________

The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of Atos Euronext Market Solutions.
_________________________________________



=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to