Cai, Lucy (L.) wrote:
> Hi, all,
>
> I have a question about regular expression:
>
> my code is like this:
> **********************************************************************
> sub IsPVob
> {
> my ($Vob) = @_;
>
> my $Output = `cleartool lsvob $Vob`;
> die "IsPVob can't list vob $Vob" if $?;
>
> return (($Output =~ /.*\(ucmvob\)/s*$/) ? 1 : 0);
return $Output =~ /.*\(ucmvob.*\)\s*$/ ? 1 : 0;
^^ you have to allow for ',replicated'
or simpler if you just are interested in ucmvob being present:
return $Output =~ /ucmvob/ ? 1 : 0;
> }
> **********************************************************************
>
> $Output ="/vobs/na_mscs_pvob
> /ccstore/ecc/vobs_fcis321/na_mscs_pvob.vbs public (ucmvob,replicated)"
>
> What I want to do is if this tring include word "ucmvob", then return 1,
> else return 0.
>
> My code does not work, it return 0. Could you please see why it is like
> this? or do you have a better idea?
_______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs