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

[Omaha.pm] (?:pattern)



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@mutationgrid.com | http://mutationgrid.com | 1-402-598-7782