Prahlad Vaidyanathan wrote:
> 
> Was wondering which of these 2 pieces of code is more efficient :
> 
> <code1>
>     my $file ;
>     foreach $file (@tarred) { #do something ; }
>     foreach $file (@gzipped) { #do something else ; }
> </code1>
> 
>         OR
> 
> <code2>
>     foreach my $file (@tarred) { #do something ; }
>     foreach my $file (@gzipped) { #do something else ; }
> </code2>
> 
Just try it for your own.
Use the Benchmark module from CPAN.

But never forget, 
speed is not so important. 
(Otherwise you would have used C)
Readability comes first.

And then of course
it's important to avoid useless statements like 
my $file;
which does really nothing more as a declaration.

That's why I would prefer:
>     foreach my $file (@tarred) { #do something ; }
>     foreach my $file (@gzipped) { #do something else ; }


Greetings,
Andrea

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to