in reply to Foreach & file io

It all depends on what you did to $/, see perlvar. If you leave that alone, your script always will read single lines with the  for my $line (<INFILE>) or my $line=<INFILE>; syntax.

Beware, though, that fileGLOBs are written as  open IN, $file;. Your $INFILE will work on a variable, that's not what you (probably) want.

(Update Unless you pass a reference to a fileGLOB :-). I would use lowercase here though, to take away possible confusion with real fileGLOBs and constants. Try $fh_infile, eg.)

Cheers,

Jeroen
"We are not alone"(FZ)

Replies are listed 'Best First'.
Re: Re: Foreach & file io
by Xxaxx (Monk) on Jun 05, 2001 at 14:22 UTC
    Thanks the perlvar was the piece that solved the puzzle.
    Seems like no matter how many times I read that thing I only remember the stuff I have a need for before I read it.

    Thanks again
    Claude

    p.s. the $INFILE is actually correct since I'm opening my file in a subroutine then returning *FH.