Re: Syntax for if

2010-02-08 Thread Uri Guttman
> "7" == 7 <7stud.7s...@gmail.com> writes: 7> On Mon, Feb 8, 2010 at 9:33 PM, Uri Guttman wrote: >> > "7" == 7 <7stud.7s...@gmail.com> writes: >> 7> they both read fine in english which is why they we included by >> larry. 7> They don't both read fine. To many people, u

Re: Syntax for if

2010-02-08 Thread 7
On Mon, Feb 8, 2010 at 9:33 PM, Uri Guttman wrote: > > "7" == 7 <7stud.7s...@gmail.com> writes: > they both read fine in english which is why they we included by > larry. They don't both read fine. To many people, unless is a confusing construct. Larry has made plenty of mistakes design

Re: Syntax for if

2010-02-08 Thread Uri Guttman
> "7" == 7 <7stud.7s...@gmail.com> writes: 7> Because unless and until statements are harder to maintain, NO ONE should 7> use them--least of all beginners. 7>  Because unless and until statements are harder to *read and maintain*, NO ONE 7> should use them--least of all be

Re: Syntax for if

2010-02-08 Thread Uri Guttman
> "7" == 7 <7stud.7s...@gmail.com> writes: 7> On Mon, Feb 8, 2010 at 6:19 PM, Uri Guttman wrote: >> "7" == 7  <7stud.7s...@gmail.com> writes: 7>  7> if (defined $var && ($var eq '' || $var eq '0')) { 7>  7>     #code 7>  7> } 7>  7> to handle c

Re: Syntax for if

2010-02-08 Thread 7
On Mon, Feb 8, 2010 at 6:45 PM, Chris Coggins wrote: > Thanks Jim. I used > > exit(0) unless $varA; > That form of unless is especially poor style.

Re: Syntax for if

2010-02-08 Thread 7
On Mon, Feb 8, 2010 at 9:00 PM, 7 <7stud.7s...@gmail.com> wrote: > On Mon, Feb 8, 2010 at 6:19 PM, Uri Guttman wrote: > >> > "7" == 7 <7stud.7s...@gmail.com> writes: >> >> 7> if (defined $var && ($var eq '' || $var eq '0')) { >> >> 7> #code >> >> 7> } >> >> 7> to handle cases where $

Re: Syntax for if

2010-02-08 Thread 7
On Mon, Feb 8, 2010 at 6:19 PM, Uri Guttman wrote: > > "7" == 7 <7stud.7s...@gmail.com> writes: > > 7> if (defined $var && ($var eq '' || $var eq '0')) { > > 7> #code > > 7> } > > 7> to handle cases where $var = undef. undef acts like it is a blank > 7> string when used as a string

Re: Syntax for if

2010-02-08 Thread Chris Coggins
Jim Gibson wrote: On 2/8/10 Mon Feb 8, 2010 6:07 PM, "Chris Coggins" scribbled: Chris Coggins wrote: I'm adding this exit step into the script to keep people from trying to execute it outside of the normal web interface. The script and browser communicate normally if the script is

Re: Syntax for if

2010-02-08 Thread Jim Gibson
On 2/8/10 Mon Feb 8, 2010 6:07 PM, "Chris Coggins" scribbled: > > > Chris Coggins wrote: >> I'm adding this exit step into the script to keep people from trying >> to execute it outside of the normal web interface. The script and >> browser communicate normally if the script is executed throu

Re: Syntax for if

2010-02-08 Thread Chris Coggins
Chris Coggins wrote: I'm adding this exit step into the script to keep people from trying to execute it outside of the normal web interface. The script and browser communicate normally if the script is executed through its original form. What I'm trying to prevent is someone trying to execute

Re: Syntax for if

2010-02-08 Thread Jim Gibson
On 2/8/10 Mon Feb 8, 2010 5:45 PM, "Chris Coggins" scribbled: > Thanks Jim. I used > > exit(0) unless $varA; > > and it worked good from command line. When I try the script through a > browser pointing to the file like so > http://domain.com/cgi-bin/script.pl?varA=10 > the script executes

Re: Syntax for if

2010-02-08 Thread Chris Coggins
Thanks Jim. I used exit(0) unless $varA; and it worked good from command line. When I try the script through a browser pointing to the file like so http://domain.com/cgi-bin/script.pl?varA=10 the script executes as it should. But when I try to send 0 as the value (?varA=0), I get a code 500

Re: Syntax for if

2010-02-08 Thread Uri Guttman
> "7" == 7 <7stud.7s...@gmail.com> writes: 7> if (defined $var && ($var eq '' || $var eq '0')) { 7> #code 7> } 7> to handle cases where $var = undef. undef acts like it is a blank 7> string when used as a string. blah.. unless( $var ) { is all you need for that si

Re: Syntax for if

2010-02-08 Thread 7
On 2/8/10, 7 <7stud.7s...@gmail.com> wrote: > On 2/8/10, 7 <7stud.7s...@gmail.com> wrote: >> On 2/8/10, Chris Coggins wrote: >>> What is the proper syntax for a comparison at the end of a subroutine to >>> stop the script if a certain variable is "0" or ''? >>> >>> sub routine{ >>> (get data and p

Re: Syntax for if

2010-02-08 Thread 7
On 2/8/10, 7 <7stud.7s...@gmail.com> wrote: > On 2/8/10, Chris Coggins wrote: >> What is the proper syntax for a comparison at the end of a subroutine to >> stop the script if a certain variable is "0" or ''? >> >> sub routine{ >> (get data and process it) >> if $varA = '' || $varA = "0" { >> (sto

Re: Syntax for if

2010-02-08 Thread 7
On 2/8/10, Chris Coggins wrote: > What is the proper syntax for a comparison at the end of a subroutine to > stop the script if a certain variable is "0" or ''? > > sub routine{ > (get data and process it) > if $varA = '' || $varA = "0" { > (stop script, print error message to user) > } > else{ >

Re: Syntax for if

2010-02-08 Thread Jim Gibson
On 2/8/10 Mon Feb 8, 2010 4:56 PM, "Chris Coggins" scribbled: > What is the proper syntax for a comparison at the end of a subroutine to > stop the script if a certain variable is "0" or ''? > > sub routine{ > (get data and process it) > if $varA = '' || $varA = "0" { > (stop script, print err

Syntax for if

2010-02-08 Thread Chris Coggins
What is the proper syntax for a comparison at the end of a subroutine to stop the script if a certain variable is "0" or ''? sub routine{ (get data and process it) if $varA = '' || $varA = "0" { (stop script, print error message to user) } else{ (continue with script) } -- To unsubscribe, e-mai