[Omaha.pm] tweak
Andy Lester
andy at petdance.com
Tue Apr 25 13:06:20 PDT 2006
On Tue, Apr 25, 2006 at 02:54:09PM -0500, Jay Hannah (jhannah at omnihotels.com) wrote:
> My after:
>
> my $pageid;
> foreach ($q->param) {
> s/^view__Record__// || next;
> $pageid = $_;
> last;
> }
You can use that s/// in a boolean context
foreach ($q->param) {
if (s/^view__Record__//) {
$pageid = $_;
last;
}
}
If you don't want to do a replacement for some reason:
foreach ($q->param) {
if (/^view__Record__(.+)/) {
$pageid = $1;
last;
}
}
This last one I think is the clearest, because what you're saying is
"match view__Record__ followed by something else, and I want to keep the
something else".
xoa
--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
More information about the Omaha-pm
mailing list