3 ms·
Please don't blame bare word file handles on "C heritage" -- Some of the improvements were needed because in places Perl’s Unix/C heritage shows through a lit
by ksherlock 4y ago
Please don't blame bare word file handles on "C heritage"
--
Some of the improvements were needed because in places Perl’s Unix/C heritage shows through a little more than we’d like it to in the 21st century. One good example of this is bareword filehandles. You’re probably used Perl code to open a file looking like this:
open FH, 'filename.dat' or die;
- tyingq 4y agoMaybe the thinking was that Perl's STDIN, STDOUT, STDERR, came from c's (well, stdio.h's) stdin, stdout, stderr? Which then inspired the bad idea of expanding on that?
- ksherlock 4y agoIt's more from sed/awk/shell I suppose. eg, open FH, "<filename" vs FILE *fh = fopen("filename","r")
- tyingq 4y agoFor the <,> and variations, sure. Though IO::File has been there a long time and looks a lot more like your C example. IO::Handle also. Supports, for example: $fh = IO::File->new("filename", "r"); Or, as with C, things like O_WRONLY|O_APPEND in place of "r".