For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > April 2005 > How to use a switch statement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to use a switch statement
1911que@gmail.com

2005-04-18, 8:55 pm

Hello,

I have been trying to read up on using Switch.pm and using it in a Perl
script that I am trying to speed up.

Currently I have 91 if..elsif statements (See sample below) and I have
execution times of::

Server: 0.37
User: 0.09

Is there anyone that might show me how to code the first few lines to
get the ball rolling?

Sample:
==================
if ($form{'action'} eq 'new') { &new; }
elsif ($form{'action'} eq 'clientfinder') {&clientfinder();}
elsif ($form{'action'} eq 'tracking') { &tracking(); }
elsif ($form{'action'} eq 'proctracking') { &proctracking(); }
# elsif statements -sniped-
else { &cat; }
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com