Ken Barker wrote:
> When I use the defined function in testing for a valid open file handle - it 
> appears that it eats the first line of the file.  Here is a test line:
> 
> while(defined(<FILE2>) and $line2 = <FILE2> and $found == 0){

<FILE2> reads a line from FILE2 - the <> is not part of the FH it's the
'next line' operator.

You should have errored off at the open and not even gotten to this part
of your logic.  Or you could use a vrbl with a FH glob/ref and test that
rather than the filehandle.

        open FH1, 'foobar';
        my $FILE2 = *FH1;       # glob
or
        my $FILE2 = \*FH1;      # reference
        if (defined $FILE2 ...

or use IO::File :

        use IO::File;
        my $FILE2 = new IO::File 'foobar';
        if (defined $FILE2 ...

> I have put print statements after this line and can see that it misses the 
> first line from this file.  Any suggestions?

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to