[Omaha.pm] tweak

Jay Hannah jhannah at omnihotels.com
Tue Apr 25 12:54:09 PDT 2006


Another quickie for work today...

Before:

  my $pageid;
  foreach my $param ($q->param) {
    next if ($param !~ /^view__Record__/);
    $param =~ s/^(view__Record__)//;
    $pageid = $param;
  }

My after:

  my $pageid;
  foreach ($q->param) {
    s/^view__Record__// || next;
    $pageid = $_;
    last;
  }

Untested, so mine might not even work. If it works, I like mine better.
:)

(1) more readable IMHO 
(2) since there's only supposed to by 1 pageid, mine skips all other
params after pageid is found.

j



More information about the Omaha-pm mailing list