Re: Case statements

2005-04-12 Thread Jonathan Paton
On Apr 12, 2005 4:24 PM, David Gilden <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to create case statement, and I am not sure I am on the right > track, > any comments? perldoc Switch Jonathan Paton -- #!perl $J=' 'x25 ;for (qq< 1+10 9+14 5-10 50-9 7+13 2-18 6+13 17+6 02+1 2-10 00+4 0

RE: Case statements

2005-04-12 Thread Chris Devers
On Tue, 12 Apr 2005, Wagner, David --- Senior Programmer Analyst --- WGO wrote: > Chris Devers wrote: > > Also, as a side note, if $whichForm is numeric, you should just use > > the nueric comparisons rather than the string ones: > > > > if $whichForm eq "123" # bad! > > if $whichForm

RE: Case statements

2005-04-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Chris Devers wrote: > On Tue, 12 Apr 2005, David Gilden wrote: > >> I am trying to create case statement, and I am not sure I am on the >> right track, any comments? > > Would something like this get the same result? > > my %form_action = ( > 000 => sub {}, # silently ignore this one

Re: Case statements

2005-04-12 Thread Chris Devers
On Tue, 12 Apr 2005, David Gilden wrote: > I am trying to create case statement, and I am not sure I am on the right > track, > any comments? Would something like this get the same result? my %form_action = ( 000 => sub {}, # silently ignore this one 123 => handle_form(123);

Re: Case statements

2005-04-12 Thread Ing. Branislav Gerzo
David Gilden [DG], on Tuesday, April 12, 2005 at 10:24 (-0500) typed the following: DG> I am trying to create case statement, and I am not sure I am on the right track, DG> any comments? try to write at your console your subject, eg: perldoc -q "case statement" -- ...m8s, cu l8r, Brano. ["W

Case statements

2005-04-12 Thread David Gilden
Hello, I am trying to create case statement, and I am not sure I am on the right track, any comments? Thanks, Dave Gilden SWITCH: { ## yacht form if ($whichForm eq "123") { $subject = "123 Form"; $recipient = "[EMAIL PROTECTED]"; $cc = "[EMAIL PROTECTED]"; LAST SWITCH; } ## regatta form

Re: Does Perl have "Case" Statements?

2002-02-28 Thread sachin balsekar
Hi, Perl as such doesnt have support case structures u cud try using block which is almost similar to case struct.. A BLOCK by itself (labeled or not) is semantically equivalent to a loop that executes once. Thus you can use any of the loop control statements in it to leave or restart the

Re: Does Perl have "Case" Statements?

2002-02-28 Thread Chris
Jenda Krynicky wrote: > From: Chris <[EMAIL PROTECTED]> > >>I have been looking in the Learning Perl book, and cannot find it. >> >>I am sure that it is just a terminology thing. >> >>In VB {Yeah the old VB again :P) I could do: >> >>Select Case $Junk >> Case 1 >>Do Something >> C

Re: Does Perl have "Case" Statements?

2002-02-28 Thread Brett W. McCoy
> On Thu, 28 Feb 2002, Chris wrote: > > > I have been looking in the Learning Perl book, and cannot find it. > > There isn't a syntactical element in Perl to do case statements (aka > switch in C/C++ & Java). However, they can be done in a variety of ways: I forg

Re: Does Perl have "Case" Statements?

2002-02-28 Thread Jenda Krynicky
From: Chris <[EMAIL PROTECTED]> > I have been looking in the Learning Perl book, and cannot find it. > > I am sure that it is just a terminology thing. > > In VB {Yeah the old VB again :P) I could do: > > Select Case $Junk > Case 1 > Do Something > Case 2 > Do Somethi

Re: Does Perl have "Case" Statements?

2002-02-28 Thread John W. Krahn
Chris wrote: > > I have been looking in the Learning Perl book, and cannot find it. > I am sure that it is just a terminology thing. > In VB {Yeah the old VB again :P) I could do: > > Select Case $Junk > Case 1 > Do Something > Case 2 > Do Something > Case 3 >

Re: Does Perl have "Case" Statements?

2002-02-28 Thread Brett W. McCoy
On Thu, 28 Feb 2002, Chris wrote: > I have been looking in the Learning Perl book, and cannot find it. There isn't a syntactical element in Perl to do case statements (aka switch in C/C++ & Java). However, they can be done in a variety of ways: use the Switch.pm module or use

Re: Does Perl have "Case" Statements?

2002-02-28 Thread Michael Kelly
On 2/28/02 1:41 PM, Chris <[EMAIL PROTECTED]> wrote: > I have been looking in the Learning Perl book, and cannot find it. > > I am sure that it is just a terminology thing. > > In VB {Yeah the old VB again :P) I could do: > > Select Case $Junk > Case 1 > Do Something > Case 2 > Do Something >

Does Perl have "Case" Statements?

2002-02-28 Thread Chris
I have been looking in the Learning Perl book, and cannot find it. I am sure that it is just a terminology thing. In VB {Yeah the old VB again :P) I could do: Select Case $Junk Case 1 Do Something Case 2 Do Something Case 3 Do Something Case 4

Re: ternary operator stability(e.g., in "case" statements)

2001-05-22 Thread Paul
--- Adam Turoff <[EMAIL PROTECTED]> wrote: > On Tue, May 22, 2001 at 09:37:13AM -0700, Paul wrote: > > Anybody know if there would likely be any problem with building a > > "case" statement like the folowing (without installing Switch.pm)? > > > > sub rate ($) { > > $_[0] eq 'A' ? .03 : > >

Re: ternary operator stability(e.g., in "case" statements)

2001-05-22 Thread Paul
--- Jeff Pinyan <[EMAIL PROTECTED]> wrote: > On May 22, Paul said: > > >I know that in many C compilers, the a ? b : c construct with the > >ternary ?: operator si not stable after the second or third nesting, > >but I've never seen that sort of problem in tests I've run in Perl. > > The only t

Re: ternary operator stability(e.g., in "case" statements)

2001-05-22 Thread Adam Turoff
On Tue, May 22, 2001 at 09:37:13AM -0700, Paul wrote: > Anybody know if there would likely be any problem with building a > "case" statement like the folowing (without installing Switch.pm)? > > sub rate ($) { > $_[0] eq 'A' ? .03 : > $_[0] eq 'B' ? .05 : > $_[0] eq 'C' ? .06 : >

Re: ternary operator stability(e.g., in "case" statements)

2001-05-22 Thread Jeff Pinyan
On May 22, Paul said: >I know that in many C compilers, the a ? b : c construct with the >ternary ?: operator si not stable after the second or third nesting, >but I've never seen that sort of problem in tests I've run in Perl. The only to watch out for is precendence: $a ? $b = $c : $b = $d;

ternary operator stability(e.g., in "case" statements)

2001-05-22 Thread Paul
Hi all. I know that in many C compilers, the a ? b : c construct with the ternary ?: operator si not stable after the second or third nesting, but I've never seen that sort of problem in tests I've run in Perl. Anybody know if there would likely be any problem with building a "case" statement li