RE: select case or switch statement

2005-06-12 Thread Charles K. Clarkson
Omega -1911 wrote: : I am still trying to grasp using case statements... Since I am : new to this, I had a question as to the speed of using CASE. I : currently have a script that has 91 if/elsif/else statements in : total. Will switching to using CASE improve the execut

Re: select case or switch statement

2005-06-12 Thread Omega -1911
AIL PROTECTED]> wrote: > On Sat, 11 Jun 2005, Jeff 'japhy' Pinyan wrote: > > > On Jun 11, Ron Smith said: > > > > > Does Perl have the equivalent of a case statement or a switch > > > statement. I'm trying to avoid a bunch of "if-then&quo

Re: select case or switch statement

2005-06-11 Thread Chris Devers
On Sat, 11 Jun 2005, Jeff 'japhy' Pinyan wrote: > On Jun 11, Ron Smith said: > > > Does Perl have the equivalent of a case statement or a switch > > statement. I'm trying to avoid a bunch of "if-then" statements. > > I'm seeing posts regardin

Re: select case or switch statement

2005-06-11 Thread Jeff 'japhy' Pinyan
On Jun 11, Ron Smith said: Does Perl have the equivalent of a case statement or a switch statement. I'm trying to avoid a bunch of "if-then" statements. I'm seeing posts regarding "use switch", but I want to make sure it's not a deprecated practice. I

Re: select case or switch statement

2005-06-11 Thread Ron Smith
I used 'perldoc -f switch' and nothing came up. I've done what you suggested and I'm on my way. Thank you very much. R "Ing. Branislav Gerzo" <[EMAIL PROTECTED]> wrote: Ron Smith [RS], on Saturday, June 11, 2005 at 14:11 (-0700 (PDT)) has on mind: RS> Does Perl have the equivalent of a case st

Re: select case or switch statement

2005-06-11 Thread Ing. Branislav Gerzo
Ron Smith [RS], on Saturday, June 11, 2005 at 14:11 (-0700 (PDT)) has on mind: RS> Does Perl have the equivalent of a case statement or a switch RS> statement. I'm trying to avoid a bunch of "if-then" statements. RS> I'm seeing posts regarding "use switch", but I want to make sure RS> it's not a d

select case or switch statement

2005-06-11 Thread Ron Smith
Does Perl have the equivalent of a case statement or a switch statement. I'm trying to avoid a bunch of "if-then" statements. I'm seeing posts regarding "use switch", but I want to make sure it's not a deprecated practice. I'm using Perl -v 5.8.0. my

Re: last question on the switch statement ....

2005-04-18 Thread John W. Krahn
David Gilden wrote: Dear fellow PERL coders..., Hello, What is the "&& do" part of the code doing, i.e. I am looking to understand the syntax, the example was found in perl beginners archive, from some else's post... && is the logical 'and' operator. If the expression on its left is evaluated as

Re: last question on the switch statement ....

2005-04-18 Thread Vladimir D Belousov
Sorry for my English :) '&&' is a boolean operator. It returns TRUE when both statemets are ture, and false on other cases. But if the first statement is false, next statement will not be executed. For example: $hash{key} doesn't exists - if(exists($hash{key}) && $hash{key} =~ /\d+/); Is $^W is tru

last question on the switch statement ....

2005-04-17 Thread David Gilden
Dear fellow PERL coders..., What is the "&& do" part of the code doing, i.e. I am looking to understand the syntax, the example was found in perl beginners archive, from some else's post... Thanks, Dave (kora musician / audiophile / webmaster @ www.coraconnection.com / Ft. Worth, TX, USA) f

Re: Does the SWITCH statement have a default?

2005-01-20 Thread Josimar Nunes de Oliveira
case 4 { print "\n Four" } case 6 { print "\n Six" } else { print "\nOthers" } } } Josimar Nunes de Oliveira SP/Brasil - Original Message - From: <[EMAIL PROTECTED]> To: "Perl Beginners List" Sent: Thursday, J

Re: Does the SWITCH statement have a default?

2005-01-20 Thread Peter_Farrar
>Is there a correct way to define a default case within a SWITCH? I tried with >the bottom case, but that errors with: >Quantifier follows nothing before HERE mark in regex m/* << HERE / at ./ctest line 251. >SWITCH: >{ > $field =~ /^CR\d{0,7}$/ && do >{ > $openCRs++; >

Does the SWITCH statement have a default?

2005-01-20 Thread Paul Ohashi
Hi, Is there a correct way to define a default case within a SWITCH? I tried with the bottom case, but that errors with: Quantifier follows nothing before HERE mark in regex m/* << HERE / at ./ctest line 251. SWITCH: { $field =~ /^CR\d{0,7}$/ && do { $openCRs++; pr

Re: built-in switch statement?

2004-12-06 Thread Jonathan Paton
Hi, Larry Wall mentions this in the Apocalypse 4 document for Perl 6: "Another argument against having a switch statement in Perl 6 is that we never had it in the first five versions of Perl. But it would be incorrect to say that we didn't miss it. What actually happened was that

built-in switch statement?

2004-12-06 Thread pablo wablo
I'm just wondering what is the reason that switch is not built-in in perl... I can do a switch statement by using the Switch module, but I'm wondering why it's not already builtin with the interpreter. thanks __ Do You Yahoo!

Re: switch statement

2004-02-19 Thread WilliamGunther
I just benchmarked Filter, and it was worse than 100 times slower In a message dated 2/19/2004 6:53:56 PM Eastern Standard Time, [EMAIL PROTECTED] writes: last time i benchmark a source filter, it's about 100 times slower. has that change since v5.8? -Will ---

Re: switch statement

2004-02-19 Thread John W. Krahn
Anthony Vanelverdinghe wrote: > > Hi Hello, > Could anyone please tell me what's wrong with the following "program"? > The compiler gives errors in the switch statement. > > %commands=('v',0,'w',1,'t',2,'/pattern/&

Re: switch statement

2004-02-19 Thread david
Rob Dixon wrote: > <[EMAIL PROTECTED]> wrote: >> >> The Advantage is you get to use the switch statement. The disadvantage is >> your code will run extraordinarily slow because the Switch module uses a >> run time Filter. In short: isn't an is-elsif-else

Re: switch statement

2004-02-19 Thread James Edward Gray II
On Feb 19, 2004, at 5:21 PM, Paul Johnson wrote: The problem is that Switch.pm is a source filter, which is effectively an extra level of processing before compilation. Personally, I wouldn't use a source filter for anything I cared about. The docs for Switch state: There are undoubtedly serio

Re: switch statement

2004-02-19 Thread Paul Johnson
On Thu, Feb 19, 2004 at 10:46:33PM -, Rob Dixon wrote: > <[EMAIL PROTECTED]> wrote: > > > > The Advantage is you get to use the switch statement. The disadvantage is > > your code will run extraordinarily slow because the Switch module uses a run time > > Fi

Re: switch statement

2004-02-19 Thread WilliamGunther
This: if ($op == 0) {} elsif ($op == 1) {} elsif ($op == 2) {} elsif ($op == 3) {} elsif ($op == 4) {} elsif ($op == 5) {} is faster than this: use Switch; switch ($op) { case 0 { last } case 1 { last } case 2 { last } case 3 { last } case 4 { last } case 5 { last } } B

Re: switch statement

2004-02-19 Thread Rob Dixon
<[EMAIL PROTECTED]> wrote: > > The Advantage is you get to use the switch statement. The disadvantage is > your code will run extraordinarily slow because the Switch module uses a run time > Filter. In short: isn't an is-elsif-else statement enough?? Are you saying th

Re: switch statement

2004-02-19 Thread u235sentinel
te: > > > Hi > > Howdy. > > > Could anyone please tell me what's wrong with the following "program"? > > I'll try. > > > The compiler gives errors in the switch statement. > > Perl doesn't have a native switch statement, b

Re: switch statement

2004-02-19 Thread WilliamGunther
The Advantage is you get to use the switch statement. The disadvantage is your code will run extraordinarily slow because the Switch module uses a run time Filter. In short: isn't an is-elsif-else statement enough?? In a message dated 2/19/2004 4:40:56 PM Eastern Standard Time, [EMAIL PROT

Re: switch statement

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 10:29 PM +0100, Anthony Vanelverdinghe is alleged to have said: Didn't know it wasn't in Perl, but I've just discovered it's possible with some file called "Switch.pm" --As for the rest, it is mine. You mean the 'Switch' module. (Sorry, I should have mentione

Re: switch statement

2004-02-19 Thread James Edward Gray II
On Feb 19, 2004, at 3:14 PM, Anthony Vanelverdinghe wrote: Hi Howdy. Could anyone please tell me what's wrong with the following "program"? I'll try. The compiler gives errors in the switch statement. Perl doesn't have a native switch statement, but it is included

Re: switch statement

2004-02-19 Thread Anthony Vanelverdinghe
Didn't know it wasn't in Perl, but I've just discovered it's possible with some file called "Switch.pm" From: Daniel Staal <[EMAIL PROTECTED]> Reply-To: Perl Beginners <[EMAIL PROTECTED]> To: Perl Beginners <[EMAIL PROTECTED]> Subject: Re: switch

Re: switch statement

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 10:14 PM +0100, Anthony Vanelverdinghe is alleged to have said: Could anyone please tell me what's wrong with the following "program"? The compiler gives errors in the switch statement. --As for the rest, it is mine. You mean, besides the

switch statement

2004-02-19 Thread Anthony Vanelverdinghe
Hi Could anyone please tell me what's wrong with the following "program"? The compiler gives errors in the switch statement. Thx!! Anthony %commands=('v',0,'w',1,'t',2,'/pattern/',3,'s',4,'x',5); $end = 0; while (!end