Calvin,
Two things come to mind. First of all you can do a "chomp" which
will strip off the CR from the end of the string as in
chomp($view);
Also, you are using a numeric comparison (==) not a string comparison (eq).
What I do in this situation is a pattern match like this:
$CT = "/usr/atria/bin/cleartool";
$in_view = `$CT pwv -short`;
if ($in_view =~ /NONE/) {
print "\nError: Must be in a view\n";
print "Exiting...\n\n";
exit 1;
}
It eliminates the need for the chomp but if executed from a view that
contains "NONE", the script will think it's not in a view.
Hope this helps,
Rich Szczepanski
Xerox Corporation
-----Original Message-----
From: Calvin Jackson [mailto:cjac44@cbot.com
Sent: Thursday, January 06, 2000 2:42 PM
To: cciug@Rational.Com
Subject: [cciug] Perl Question....
Could a Perl guru help me solve this mystery:
I am trying to assign a scalar var by
executing a cleartool shell command.
i.e. $view=`cleartool pwv -s`
However, the lvalue that I am getting
isn't what I want. It seems that Perl
is inserting a 'return key/newline' literal
in my lvalue. So if I test $view == "** NONE **'
all day, my test always equates to false.
Any ideas?
Calvin Jackson
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
with
body
can also
unsubscribe
customers-only
website
http://clearcase.rational.com/cciug/mailing_list.html
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This archive was generated by hypermail 2b29 : Sun May 06 2001 - 00:22:19 EDT