conditional statement

2002-08-27 Thread Javeed SAR
Hi all, I am using 2 conditional statements, as follows: if (($vbpcount==1) ||($dspcount==1)) { die "\n\nThe element ($PN) is not allowed to be added to ClearCase,Because a project already exists.\n"; } elsif(($vbpcount==1) && ($dspcount==1)) {die "\n\nThe element ($PN) is not allowed to b

Regarding conditional statement

2008-11-24 Thread suresh kumar
Hi, Here is the sample code: sub a { print "i am a\n"; return 0; } sub b { print "i am b\n"; return 1; } if (a() && b()) { print "yes\n"; } else { print "no\n"; } I want both the subroutine to be executed, and then i want print some statements depending upon both the results. here if a() ret

Re: conditional statement

2002-08-27 Thread Omanakuttan
> if (($vbpcount==1) ||($dspcount==1)) > { die "\n\nThe element ($PN) is not allowed to be added to > ClearCase,Because a project already exists.\n"; > } > > elsif(($vbpcount==1) && ($dspcount==1)) > {die "\n\nThe element ($PN) is not allowed to be added to ClearCase,Because > a project already e

Re: conditional statement

2002-08-27 Thread John W. Krahn
Javeed Sar wrote: > > Hi all, Hello, > I am using 2 conditional statements, as follows: > > if (($vbpcount==1) ||($dspcount==1)) > { die "\n\nThe element ($PN) is not allowed to be added to > ClearCase,Because a project already exists.\n"; > } > > elsif(($vbpcount==1) && ($dspcount==1)) > {d

Re: conditional statement

2002-08-27 Thread Paul Johnson
On Wed, Aug 28, 2002 at 11:08:14AM +0530, Javeed SAR wrote: > Hi all, > > I am using 2 conditional statements, as follows: > > > > > if (($vbpcount==1) ||($dspcount==1)) > { die "\n\nThe element ($PN) is not allowed to be added to > ClearCase,Because a project already exists.\n"; > } > >

Re: conditional statement

2002-08-27 Thread Paul Johnson
On Wed, Aug 28, 2002 at 07:57:26AM +0200, Paul Johnson wrote: > If a || b is true then by > definition a && b will be true. Sorry, that's backwards. If a && b is true then by definition a || b will be true. The rest of the post holds though. -- Pa

Re: conditional statement

2002-08-28 Thread Janek Schleicher
Javeed Sar wrote at Wed, 28 Aug 2002 07:38:14 +0200: > if (($vbpcount==1) ||($dspcount==1)) > { die "\n\nThe element ($PN) is not allowed to be added to > ClearCase,Because a project already exists.\n"; > } > > elsif(($vbpcount==1) && ($dspcount==1)) > {die "\n\nThe element ($PN) is not allowe

an odd conditional statement

2010-06-09 Thread sillymonkeysoftw...@gmail.com
ously false my $result = ($statement) ? 1 : 0;# conditional test Now, $result will always be true(1), because the conditional is really, in effect, just validating that $statement is a defined scalar, not testing the statement. But, how can I perform an actual conditional statement on t

Conditional statement and param()

2003-09-01 Thread B. Fongo
as an argument to the script. What is wrong in the conditional statement or param(). I tried "my $value_of_param " and "use vars qw($value_of_param)" but the value remains unpredictable. Thanks for any help # @links = (

Re: Regarding conditional statement

2008-11-24 Thread David Schmidt
my $ret_a = a(); my $ret_b = b(); if ($ret_a && $ret_b) { (...) } On Mon, Nov 24, 2008 at 11:41 AM, suresh kumar <[EMAIL PROTECTED]> wrote: > Hi, > > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } > > sub b { > print "i am b\n"; > return 1; > } > > if (a() && b()) { > pr

RE: Regarding conditional statement

2008-11-24 Thread Stewart Anderson
> -Original Message- > From: suresh kumar [mailto:[EMAIL PROTECTED] > Sent: 24 November 2008 10:41 > To: beginners@perl.org; [EMAIL PROTECTED]; Amit Saxena > Subject: Regarding conditional statement > > Hi, > > Here is the sample code: > > sub a

Re: Regarding conditional statement

2008-11-24 Thread Dr.Ruud
"suresh kumar" schreef: > I want both the subroutine to be executed, and then i want print > some statements depending upon both the results. my $all = 1; a() or $all = 0; b() or $all = 0; c() or $all = 0; if ($all) { ... } -- Affijn, Ruud "Gewoon is een tijger."

Re: Regarding conditional statement

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 18:41 +0530, suresh kumar wrote: > Thanks for the response. > > but is there anyother way to do this? > You just got three answer all essentially the same. What's wrong with them? -- Just my 0.0002 million dollars worth, Shawn The map is not the territory, the do

Re: Regarding conditional statement

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 16:11 +0530, suresh kumar wrote: > Hi, > > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } > > sub b { > print "i am b\n"; > return 1; > } > > if (a() && b()) { > print "yes\n"; > } else { > print "no\n"; > } > > > > I want both the subroutine t

Re: Regarding conditional statement

2008-11-24 Thread Jenda Krynicky
From: "suresh kumar" <[EMAIL PROTECTED]> > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } > > sub b { > print "i am b\n"; > return 1; > } > > if (a() && b()) { > print "yes\n"; > } else { > print "no\n"; > } > > > > I want both the subroutine to be executed, and then

Re: Regarding conditional statement

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 08:15, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > On Mon, 2008-11-24 at 18:41 +0530, suresh kumar wrote: >> Thanks for the response. >> >> but is there anyother way to do this? >> > > You just got three answer all essentially the same. What's wrong with > them? snip W

Re: Regarding conditional statement

2008-11-24 Thread suresh kumar
Thanks for the response. but is there anyother way to do this? On Mon, Nov 24, 2008 at 6:40 PM, Mr. Shawn H. Corey <[EMAIL PROTECTED]>wrote: > On Mon, 2008-11-24 at 16:11 +0530, suresh kumar wrote: > > Hi, > > > > Here is the sample code: > > > > sub a { > > print "i am a\n"; > > return 0; > > }

Re: Regarding conditional statement

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 16:34 +0100, Jenda Krynicky wrote: > Is there any reason you want to do that? Other than that some > braindead languages work that way? Complete evaluation of conditions > is one of the most annoying features of any language. > > If rstBlah.EOF Then > bla bla bla > ElseIf

Re: an odd conditional statement

2010-06-09 Thread Uri Guttman
s testing the string for perl's boolean truth. it is false if the value is 0, '0', '' or undef. so this is always true. sc> But, how can I perform an actual conditional statement on this? sc> What I really want is: sc> (1 < 10 and 2 > 10) ?

Re: an odd conditional statement

2010-06-09 Thread Shlomi Fish
idating that $statement is a defined > scalar, not testing the statement. > But, how can I perform an actual conditional statement on this? > What I really want is: > > (1 < 10 and 2 > 10) ? 1 : 0; > You can opt to use string eval, but this opens up a lot of se

Re: an odd conditional statement

2010-06-09 Thread Uri Guttman
ional test >> >> Now, $result will always be true(1), because the conditional is >> really, in effect, just validating that $statement is a defined >> scalar, not testing the statement. >> But, how can I perform an actual conditional statement on this?

AW: an odd conditional statement

2010-06-09 Thread Thomas Bätzler
t testing the statement. > But, how can I perform an actual conditional statement on this? > What I really want is: > > (1 < 10 and 2 > 10) ? 1 : 0; You can do something like my $cond = eval( $statement ); if( $@ ){ # an

How to manage large Conditional Statement

2010-04-20 Thread Mimi Cafe
I need to evaluate a statement in an if, elsif, else block, and the statement to evaluate in the elsif is too large as I need to run a SQL query and act on the return value. What would be a better way to achieve this? Putting the SQL statement elsewhere outside the block cannot be right, so I am wo

Re: AW: an odd conditional statement

2010-06-09 Thread Uri Guttman
> "TB" == Thomas Bätzler writes: TB> You can do something like TB> my $cond = eval( $statement ); TB> The two important things to keep in mind: TB> 1) Make sure you sanitize $statement very carefully. Otherwise people can run arbitrary perl commands and you probably don't want t

Re: How to manage large Conditional Statement

2010-04-20 Thread Uri Guttman
> "MC" == Mimi Cafe writes: MC> I need to evaluate a statement in an if, elsif, else block, and MC> the statement to evaluate in the elsif is too large as I need to MC> run a SQL query and act on the return value. What would be a MC> better way to achieve this? Putting the SQL statem

AW: How to manage large Conditional Statement

2010-04-20 Thread Thomas Bätzler
Mimi Cafe asked: > I need to evaluate a statement in an if, elsif, else block, and the > statement to evaluate in the elsif is too large as I need to run a SQL > query and act on the return value. > What would be a better way to achieve this? Putting the SQL statement > elsewhere outside the block

RE: How to manage large Conditional Statement

2010-04-21 Thread Mimi Cafe
>> -Original Message- >> I'm talking for myself here, but the way I usually do this is that I wrap >> up each SQL query or set of related SQL queries in a subroutine. >> >> If the sub's going to be used as a predicate I make sure it returns >> true/false and pass all of the relevant data

Re: How to manage large Conditional Statement

2010-04-21 Thread Uri Guttman
> "MC" == Mimi Cafe writes: MC> Earlier I thought of using an eval or BEGIN block to evaluate the MC> SQL, but then I thought wait a minute, that wouldn't be the MC> correct way of using them. Now I see that doing as you guys MC> recommended is the right way forward. a BEGIN block ma

Re: How to manage large Conditional Statement

2010-04-21 Thread Octavian Rasnita
From: "Uri Guttman" > MC> Uri: I think the quoting is much a religious issue as everyone has their > MC> preferred way, but I now know what you meant. :-) > > it isn't religious. it is just no one is taught the right way > anymore. it used to be always done this way (in the good very old > day)

Re: How to manage large Conditional Statement

2010-04-21 Thread Uri Guttman
> "OR" == Octavian Rasnita writes: OR> From: "Uri Guttman" >> >> it isn't religious. it is just no one is taught the right way >> anymore. it used to be always done this way (in the good very old >> day). with the onslaught of redmond and aol the unwashed masses didn't >> learn