Javeed Sar wrote:
> 
> I have a small doubt;
> 
> My script is given below:
> What it is doing is once the first condition is satisfied it is dieing, that
> is if (($check_out == 0)
> 
> I want the  if statement to compare this also:
>  (($var5 == "Soarian_Context_Sensitive_Coordination_File") | ($var5 ==
> "comEPRHelp") | ($var5 == "CDMS_Context_Sensitive_Coordination_File") |
> 
> am i doing something wrong??

You are using == to compare strings instead of eq.  You are using
bit-wise or | instead of the logical or || or the low precedence logical
or.  You are using double quotes on a non-interpolated string.

( $var5 eq 'Soarian_Context_Sensitive_Coordination_File' or $var5 eq
'comEPRHelp' or $var5 eq 'CDMS_Context_Sensitive_Coordination_File' or



> #!c:\perl\bin\perl

#!c:/perl/bin/perl
use warnings;
use strict;


> $PN="$ENV{'CLEARCASE_PN'}";

perldoc -q quoting

Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod
       What's wrong with always quoting "$vars"?


> ($FNAME, $FEXTENSION)=split(/\./,$PN);
> ($var1,$var2,$var3,$var4,$var5) = split(/\\/,$FNAME);

perldoc File::Basename
perldoc File::Spec
perldoc File::Spec::Win32
# look for the splitpath function


> $check_out="$ENV{'CLEARCASE_RESERVED'}";
> if (($check_out == 0)  && (($var5 ==
> "Soarian_Context_Sensitive_Coordination_File") | ($var5 == "comEPRHelp") |
> ($var5 == "CDMS_Context_Sensitive_Coordination_File") | ($var5 ==
> "CDMS_Soarian_ToC_1.2b") | ($var5 == "CDMScomEPRHelp")))

if ( $check_out == 0 and ( $var5 eq
'Soarian_Context_Sensitive_Coordination_File' or $var5 eq 'comEPRHelp'
or $var5 eq 'CDMS_Context_Sensitive_Coordination_File' or $var5 eq
'CDMS_Soarian_ToC_1.2b' or $var5 eq 'CDMScomEPRHelp' ) )


Or, you can shorten it a bit by using regular expressions:

if ( $check_out == 0 and ( $var5 =~
/^(?:Soarian|CDMS)_Context_Sensitive_Coordination_File$/ or $var5 eq
'CDMS_Soarian_ToC_1.2b' or $var5 =~ /^(?:CDMS|)comEPRHelp$/ ) )


> {#die ();
>   die "The element ($var5) is not allowed to be
> checkedout(unreserved).please  contact Clearcase administrator or javeed
> (Extn 4919).\n";
> }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to