grashoper has asked for the wisdom of the Perl Monks concerning the following question:
many thanks to all for their help, this brings up a new question I would like to change the value of a subroutine being called via a regex in another file on the same web application using patternmatching so for instance..my sub..my $site_file='<c:\sitefile.txt'; open data, $site_file || die "Horrible death"; my @lines=<data>; my $str=""; close data; for my $line(@lines){ if($Session->{'usrSystem'})=~/$line/g; $Response->Write("Found a match! Hooray"); }
would change say tutorials to mMLX40Tutorials() if site is equal to a 4.0 site.sub tSupport { my $str = ""; SWITCH: { if ($Request->item("View")->item() eq "HowTo"){ $str .= mHowTo() +; last SWITCH; } if ($Request->item("View")->item() eq "Tutorials"){ $str .= mTut +orials(); last SWITCH; } if ($Request->item("View")->item() eq "Tempotutorials"){ $str .= + mtempotutorials(); last SWITCH; } if ($Request->item("View")->item() eq "TManuals") {$str.=mTManua +ls(); last SWITCH;} if ($Request->item("View")->item() eq "PCMaint"){ $str .= mPCMai +nt(); last SWITCH; } if ($Request->item("View")->item() eq "Manuals"){ $str .= mManua +ls(); last SWITCH; } if ($Request->item("View")->item() eq "FAQ"){ $str .= mFAQ(); la +st SWITCH; } $str .= mSearch(); } return $str; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with a regex loop
by grep (Monsignor) on Oct 30, 2007 at 21:26 UTC | |
by grashoper (Monk) on Oct 30, 2007 at 21:53 UTC | |
|
Re: problem with a regex loop
by GrandFather (Saint) on Oct 30, 2007 at 21:26 UTC | |
|
Re: problem with a regex loop
by toolic (Bishop) on Oct 30, 2007 at 21:24 UTC | |
|
Re: problem with a regex loop
by Jenda (Abbot) on Oct 31, 2007 at 21:26 UTC |