if (substr($line, 42, 7) eq "Running") #best to use
or
if (substr($line, 42, 7) =~ /Running/)
assuming it's Running (without quotes) and not "Running" (with quotes)
that you are looking for
Etienne
Lance Prais wrote:
>
> I am using the following section of code to search a sub string to see a
> word is present:
>
> for(my $i=0; $i<22; $i++){<WORKFLOW>}; #This will put you at row 23.----
> $_=<WORKFLOW>;
> my $line=$_;
> print substr($line, 42, 7);
>
> It returns: Running----- which it should
>
> but if I use the following statment it always fails. Can you see the
> problem with this if statement?
>
> if (substr($line, 42, 7) eq'"Running"') #if statment to see if "Running" is
> present
> {
> while (<WORKFLOW>)
> { #Just to output some data to test
> chomp; #a)
> my $line=$_;
> print STDERR "\nline: $line";
> }
> }
> else
> {
> #send email
> }
> </code>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Etienne Marcotte
Specifications Management - Quality Control
Imperial Tobacco Ltd. - Montreal (Qc) Canada
514.932.6161 x.4001
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]