[Omaha.pm] (?:pattern)

Jay Hannah jhannah at mutationgrid.com
Thu Oct 21 07:32:32 PDT 2010


Huh. Why bother with the  ?:  chars here?

  foreach $service (@services) {
    my ($service_name, $i) = split(/,/, $service);
    $error .= &validate($service_name,$i,%in) if ($service_name =~ /^(?:INS_(?:CHC|CRS|PLV))$/);
  }

http://perldoc.perl.org/perlre.html

Since the author isn't using the backreferences anyway, why not just

   /^INS_(CHC|CRS|PLV)$/

Isn't that the same thing and easier to read?

I should probably write some little programs to test it, but I'm feeling lazy.  :)

Jay Hannah
Software Architect
jhannah at mutationgrid.com | http://mutationgrid.com | 1-402-598-7782







More information about the Omaha-pm mailing list