Rob,

Line 151 _IS_  @FILE=<CNTFILE>; and here is the entire block of code

sub OTTExecute()
{
        system($ExecCmd);
        $success = $? >> 8;
        printNotice ("$success\n");

        if ( ! $success )
        {
                my ($record_count, @FILE);
                open (CNTFILE, "${OUTPUTFILE}") or die "Can't open
${OUTPUTFILE} : $!";
                @FILE=<CNTFILE>;        <=== THIS IS LINE 151!!
                close(CNTFILE);
                $record_count=$#FILE;

                $record_count = 0 if( $FILE[$record_count] =~ /$g_no_recs/);

                printNotice ($FILE[$record_count]);
                printNotice ("$record_count\n");

                $Subject_Line = "OTT : succeeded on `hostname` --
$record_count records created";
        }
        else
        {
                $Subject_Line = "OTT : failed on `hostname`";
        }
}

_EXACT_ error:
Name "main::CNTFILE" used only once: possible typo at ./OrderTakingTree.pl
line 151.




-----Original Message-----
From: Rob Dixon [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 13, 2003 9:52
To: [EMAIL PROTECTED]
Subject: Re: Perl -w odd error


Ronald Yacketta wrote:
> Folks,
>
> I have the following block of code:
>
>         open (CNTFILE, "${OUTPUTFILE}") or die "Can't open 
> ${OUTPUTFILE} : $!";
>         @FILE=<CNTFILE>;
>         close(CNTFILE);
>
> Which reports this warning:
>
> Name "main::CNTFILE" used only once: possible typo at 
> ./OrderTakingTree.pl line 151.
>
> I am just opening the file, slurping it in and closing it. Whats the 
> prob?

I hate to say I don't believe you, but "I don't believe you". :)

CNTFILE is clearly used three times here and I'm sure this code on its own
would compile without warnings. I would guess that you've got something like
a 'package' statement in between those three lines, but whatever it is Perl
isn't seeing the three statements within the same package. Maybe it isn't
seeing all three at all. Do you have block comments like

  =comment
  =cut

in your code that you've overlooked?

I suggest you post your actual code with all the intervening lines. And tell
us whihc is line 151!

Cheers,

Rob




-- 
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]

Reply via email to