in reply to Re: sub that sets $_
in thread sub that sets $_

That would mean I have to read the whole file into memory, and return a list of chunks. Depending on the filesize this might turn out as a bad idea ;-)

Replies are listed 'Best First'.
Re^3: sub that sets $_
by anonymized user 468275 (Curate) on Jun 28, 2005 at 13:23 UTC
    No - each iteration returns a chunk into $_ in the for or foreach loop.

    One world, one people

      definitly not.
      use FTest; my $test = new FTest (); print foreach $test->foo; print for $test->foo;
      Meanwhile in a module
      package FTest; sub new { return bless {}, shift; } sub foo { return 1; } 1;
      That code prints "11". I you were correct that would be an endless loop.
        I have to pass there because I don't understand what this has to do with $_ being a default for/foreach parameter.

        One world, one people