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/',3,'s',4,'x',5); > $end = 0; > while (!end){ > print "bookmarks.html>"; > $operat

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 statement enough?? > > Are you saying that

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 > > Filter. In short: isn't an is-elsif-els

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 that 'if-elsif-else' is a compil

Re: switch statement

2004-02-19 Thread u235sentinel
In addition, I've been playing around with the 'use diagnostics' feature in perl. That's in addition to 'use warnings'. I don't recommend it for regular coding but when stumped it may help. > On Feb 19, 2004, at 3:14 PM, Anthony Vanelverdinghe wrote: > > > Hi > > Howdy. > > > Could anyone

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 PROTECTED]

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 as a module in 5.8+ Thx!! An

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 fact that Perl doesn'