> Hacksaw wrote:
> >
> > > I know this is a no brainer, but this line of code does not always work:
> > > last if( /^\n/ or /^\s+\n/ );
> >
> > Why not
> >
> > last if /^\s*$/;
> >
> > You don't need the () in this version of the construction.
> 
> That's logically identical to
> 
>   last unless /\S/;
> 

That's true, but for clarity I would stick with the first.

I also wouldn't be surprised if the \S construction is slower to match, given 
that it has a larger set of things to look at.

(On the other hand, perl might just turn "unless /\S/" into "if /\s*/". That 
seems like an obvious optimization. I wonder if there is an RE algebra?)


-- 
Offer no violence.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



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

Reply via email to