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
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
> 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
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
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";
> }
>
>
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
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
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
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 = (
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
> -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
"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."
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
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
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
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
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;
> > }
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
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) ?
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
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?
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
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
> "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
> "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
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
>> -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
> "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
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)
> "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
30 matches
Mail list logo