[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regex question



Actually, I want to grab the serial number and stuff
it into $oldserial.  

As for the alternatives...  I know what you mean but I
wouldn't know how to implement it.  *I* understand the
way *I* want to do it (even if Perl doesn't).  I'm
afraid I may have to reverse that.  :-)

--- Danny Sauer <sauer@cloudmaster.com> wrote:
> On Tue, Apr 10, 2001 at 01:20:16PM -0700, Robert
> Threet wrote:
> > If I have the following:
> > 
> >     while (<DB>) {
> > 	next unless (/(\d{10}).*serial/);
> > 	$oldserial=$1;
> > 	last;
> >     }
> > 
> > I would've thought this would find the serial
> number
> > in a DNS db file and return it as $1, then break
> out
> > of the loop.  It seems to break out of the loop
> and is
> > null.  I'm pretty fuzzy on regex and this way of
> > breaking out of a loop but I can't think of a
> better
> > way.  Does anybody see what I'm doing wrong?
> 
> I'm guessing that there's a scope problem there, but
> am not sure
> 
> Why not
> 
> 	while (<DB>) {
> 		/(\d{10}).*serial/;
> 		last if ($oldserial = $1);
> 	}
> 
> As a side note, wouldn't it be safer to look for the
> SOA line, then just
> grab the first series of numbers after the "("? (not
> to mention that I've
> got 9-digit serials... :))


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.