Help on Perl script

Hi All,

I m just writing a perl script which is using cleartool commands.

My requirement is
Need to check the list of views and send mail depends on the result.

Command to check the views is below and it will return the views if views are present.

ct lsview

If it give the list of views it should send mail as "Views Present" and if no views are present it should send mail as "NO views".

This is where i m blinking on how to send mail based on output of above command..

I just tried to use wc - l command which count the no. of lines, is there any other way for this?

Thanks!!

I don't have cc environement so i cant test.
start with this:

my $a=qx(ct lsview);
##print "$a";
if ($a) {
## call your function or utility to send mail;
} else { 
print "0 views\n";
## call your function or utility to send mail;
}
1 Like

Hi Greet_sed,

Are you missing something in the below line?

if ($a) {
## call function to send mail;

I tried something like

my $a = `ct lsview | wc -l`;
if ($a == 0)
{
## NO views;
## call function to send mail;
}
else{
## Views present;
## call function to send mail;
}