Below is an extract from the perl script, the switch/case statement seemed like 
a simple solution.



##################### Mail Program #####################################

operation_CHECKFREEPVS();
print "$numPV \n";
# print "$FreePV[1] $FreePV[0] $numPV\n";
if ($numPV ne 0 ) {
   switch ($numPV) {
          case 1 { print "$FreePV[0] \n"; }
          case 2 { print "$FreePV[0] $FreePV[1] \n"; }
          case 3 { print "$FreePV[0] $FreePV[1] $FreePV[2] \n"; }
   }
 }
 else {
   print "No PV's available \n";
 }


________________________________
 From: Chris Nehren <c.nehren/beginn...@shadowcat.co.uk>
To: beginners@perl.org 
Sent: Wednesday, 1 August 2012 2:54 PM
Subject: Re: case statement in perl
 
On Tue, Jul 31, 2012 at 23:47:45 -0500 , Hal Wigoda wrote:
> Use the switch/case combination.
> 
> On Tue, Jul 31, 2012 at 11:41 PM, Paul.G <medur...@yahoo.com.au> wrote:
> > Hi All
> >
> >
> > Does perl have a case statement or an equivalent?
> >
> >
> > Cheers
> >
> > Paul

Don't use Switch.pm. It's a source filter and causes indeterministic
code evalution. See perldoc -q switch on a recent perl (5.12 or so or
above). Consider a dispatch table.

-- 
Chris Nehren           | Coder, Sysadmin, Masochist
Shadowcat Systems Ltd. | http://shadowcat.co.uk/

Reply via email to