in reply to Re^2: file handling
in thread file handling

I like the different approach. But, I can not get your example to work. I get this error:
Can't locate object method "readline" via package "IO::File"

Admittedly, I am running an older version of perl (5.8.5 on linux), but if I look at the docs for the more recent versions of perl (5.8.8 and 5.10.0) for the IO::File core module, they also do not mention a "readline" method. Does your code actually run for you? Just curious.

Replies are listed 'Best First'.
Re^4: file handling
by Your Mother (Archbishop) on Jul 09, 2008 at 20:11 UTC

    That's because the method is called getline. :)

    while ( my $line = $fh->getline ) {
      That needs to be
      while ( defined( my $line = $fh->getline ) ) {

      defined is automatically added in some cases. That's not one of them.