A question of Style, was: SPUG: Sort an array question

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Sat Dec 28 16:38:46 CST 2002


> (Regexps for example are hard for those who don't know them, 
> but using [:alpha:] is easier for anyone to read than [a-zA-Z] 
> for example.)

Good point. IMO, the underutilized /x modifier leaps out too, eg,

$regex = qr{ ^\[(..)/(...)/(....): # capture initial date: [29/Aug/2002
             .{13}(\d+)            # skip 13 char's to conn='number'
             \s                    # single space must follow
             (?:op=(\d+))?         # capture op='number' if there
             (.*)                  # capture the rest of the line
            }x;

instead of:

$regex = qr{^\[(..)/(...)/(....).{13}(\d+)\s(?:op=(\d+))?(.*)};


rgds,
--
Charles DeRykus

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list