in reply to Re: Paul Graham on Great Hackers
in thread Paul Graham on Great Hackers

Do you mean totally abstract out the concept of a file handle, and only handle files as "big strings" (as was suggested on the perl6 language list recently), or do you mean just implementing a file-handle as a scalar? You can do that already since perl 5.6:
open my $fh,"< file"; while (<$fh>) { # stuff } close $fh;
I agree that this should have been the default from the start, but the file-handle type is probably an artifact of staying compatible with perl 4 (which had no objects).

update: here's the discussion on perl6-language

Replies are listed 'Best First'.
Re^3: Paul Graham on Great Hackers
by Jaap (Curate) on Jul 29, 2004 at 13:20 UTC
    I really mean handle files as big strings. Performace wise, these could be made equivalent:
    while (<FH>) { } # or while (split(/\n/, $file_scalar_thing) { }
    And when $file_scalar_thing goes out of scope, it's saved (if changed).
      I don't know about you, but I sure don't want every file I open to have changes saved when it goes out of scope.


      Believe nothing, no matter where you read it, or who said it - even if I have said it - unless it agrees with your own reason and your own common sense. -- Buddha