Harry Putnam wrote:

> >     I think Joseph was implying the 'chomp'. This is
> > still shorter and IMO clearer than using $_.
> >
> >     while ( my $line = <FILE> ) {
> >          chomp $line;
>
> I hope it doesn't sound like I'm being a hard head... because at my
> stage of skill I'm not likely to stand on my practices as better than
> some other... but, I'm having trouble seeing what is shorter or
> better about this.  Both have 7 entries to type.

Keystroke counting is a relic of old tecnical limitations.  I would never make
it a major concern.

>  And as for clarity,
> is it because you say `chomp $line' so it is apparent what is being
> chomped?

Yes, yes, yes.  The point is clarity.  Having the declaration right there in the
loop control communicates very boldly that this loop primarily processes lines
being read.  It may be implicit anyway, but since you have a named variable, why
not declare it where it communicates most?

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to