[m-dev.] for review: enhancements to mtags script

Peter Schachte pets at students.cs.mu.OZ.AU
Tue Jul 7 10:26:47 AEST 1998


On Mon, 6 Jul 1998, Fergus Henderson wrote:
> On 06-Jul-1998, David Matthew Overton <dmo at cs.mu.OZ.AU> wrote:
> > On Mon, Jul 06, 1998 at 04:55:39PM +1000, Andrew Bromage wrote:
> > > 
> > > Quite a few times, there appears this construction:
> > > 
> > > > +		    $_ = <srcfile>;
> > > > +		    chop;
> > > > +		    $body = $_;
> > > 
> > > Wouldn't it be simpler (and cleaner) to use this?
> > > 
> > > 	$body = <srcfile>;
> > > 	chop $body;
> > > 
> > Probably.  I just copied the style that was already in the script,
> > assuming that the person who originally wrote it must have known what
> > they were doing better than a Perl newbie like me.
> 
> Andrew Bromage is right here.  Could you please change all occurrences
> of this as he suggested?

Just be careful that $_ isn't used implicitly below.  Look for any construct
that should have more arguments than it does. 

You may object to the style of it, but $_ is quite handy for long stretches
of code that operate on the same string.  Particularly if you're doing much
pattern matching.  When I quickly read over your perl script I thought that
some of it could be streamlined by using $_, but then decided not to mention
it. 


-Peter Schachte               | I like pigs. Dogs look up to us. Cats look
mailto:pets at cs.mu.OZ.AU       | down on us. Pigs treat us as equals.
http://www.cs.mu.oz.au/~pets/ |     -- Winston Churchill 
PGP: finger pets at 128.250.37.3 | 




More information about the developers mailing list