On Tue, Jan 22, 2002 at 12:47:16AM +0000, Nick Cleaton wrote:
> On Mon, Jan 21, 2002 at 12:45:16PM -0800, Paul Makepeace wrote:
> > Then you won't like,
> 
> No, not a lot :)
> 
> > #!/usr/bin/perl -wln
> > 
> > next unless /^[^#]*<VirtualHost/../^[^#]*<\/VirtualHost/ && run_analog();
> 
> That doesn't need to be as obfuscated as that, you've placed the
> whitespace to suggest that .. binds more tightly than &&, and to
> hide the fact that .. is the heart of it.  You bad man.

Guilty as charged, although I'm sure it was unintentional -- a product
of banging out the original script in about five minutes...

> How about:
> 
> next unless
>   /^[^#]*<VirtualHost/
>   ..
>   /^[^#]*<\/VirtualHost/ && (run_analog(),1)
> ;

That works but executes the main loop on the final pass which may/may
not be a problem depending on the defined-ness or contents of $_ (e.g.
opening and reading from another file with while <FH>).

Paul

-- 
Paul Makepeace ....................................... http://paulm.com/

"What is that on your face? The supreme goal."
   -- http://paulm.com/toys/surrealism/

Reply via email to