Re: I have the following code...please advise

by "Shaun L. Sides" <arch(at)abts.net>

 Date:  Sun, 11 Jun 2000 09:20:28 -0400
 To:  <hwg-languages(at)hwg.org>
 In-Reply-To:  chronotope
  todo: View Thread, Original
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

<color><param>0100,0100,0100</param>On 10 Jun 2000, at 23:09, christopher l. filkins wrote:


<color><param>7F00,0000,0000</param>> I have the following perl code and was hoping someone might show me a more

> elegant way to do it.

> 

> Please advise.

> 

> 

> 

> 

> if ($ENV{"QUERY_STRING"} =~ /01000002/)

>             {

>     $page = "page.html?L+$track";

>             }

> if ($ENV{"QUERY_STRING"} =~ /01000003/)

>             {

>     $page = "second_page.html?L+$track";

>             }

> if ($ENV{"QUERY_STRING"} =~ /01000004/)

>             {

>     $page = "third_page.html?L+$track";

>             }


</color>I came up with this from page 689 of the Perl Cookbook.


for($ENV{"QUERY_STRING"}) {

  $page = /01000002/ && "page.html?L+$track"

       || /01000003/ && "second_page.html?L+$track"

       ||               "third_page.html?L+$track";

  }


I tested it, and it seems to work the way it should.


Hope it helps.


-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.2 -- QDPGP 2.61a
Comment: http://community.wow.net/grt/qdpgp.html

iQCVAwUBOUOSGyEw9uEAOtM/AQJ46AP/Q2lNC07F4hzZm/8rbLc7raBVHpmsXsA3
7YSnhpbb2v5WX9DfGOd1HsoloSoO1Y3QlCmh2sbd1IzNFO9JHr39SI7NZJB370tl
XPjsxu5q32AAsqtYKwUjxDd8dn91xtBsdNe581NJclXUep2pLVvNnpmX3KDBS3nf
m41cd1/734g=
=kWJu
-----END PGP SIGNATURE-----

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.