This should work...

next if $name =~
/Block|nobody|User|www|backup|ftp|httpd|root|netop|sysop|users|bill/;
next if $name =~ /^(?:\d|#)/;
next if $quota !~ /\d+/;
next if $quota <= 8;

You should also be able to combine the two (just make sure you test my
syntax)...

next if $name =~
/(?:^(?:\d|#))|Block|nobody|User|www|backup|ftp|httpd|root|netop|sysop|users
|bill/;

And the last two can be combined as well...

next if $quota <= 8;

The reason this works is because if $quota does not start with a number it
will evaluate to 0 in this context.

Rob


-----Original Message-----
From: chad kellerman [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 9:34 AM
To: [EMAIL PROTECTED]
Subject: next if........ a cleaner way?


Hello everyone,

     I want to clean this bit of code up.  It looks really messy.  I am in a

mental block.  Any suggestions?


 @userInfo = split /\s+/, $buffer;

    #insert home users & quota in the db
    foreach $userInfo ( @userInfo )  {
        
        ( $name, $quota ) = split /\|/, $userInfo;
        # get rig of the header info from repquota
   
        next if ( ( $name =~ /Block/ ) or ( $name =~ /nobody/ ) or ( $name
=~ 
/User/ ) or ( $name =~ /^\d/ ) or ( $name =~ /www/ )  or ( $name =~ /backup/

)  or ( $name =~ /ftp/ )  or ( $name =~ /httpd/ ) or ( $name =~ /root/ ) or
( 
$name =~ /netop/ ) or ( $name =~ /sysop/ ) or ( $name =~ /users/ ) or ( 
$quota !~ /\d+/ ) or ( $name =~ /^#/ ) or ( $quota <= 8 ) or ($name =~ 
/bill/) );
        

Is there an easier way to loop thru a bunch of regex?

Thanks for the help.

Chad




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

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

Reply via email to