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

[Omaha.pm] tweak



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