in reply to First attempt at bringing in file for input/output

I'll just jump in and promote the use of autodie, a module that takes care of catching file open errors. For quite a while I wrote file operations in C like this:

FILE *pif; pif = fopen ( $filename, 'r' ); if ( pif == NULL ) { /* Problem opening file.. */ } .. fclose ( pif );
When I started writing Perl, I did the same kind of thing ..
open ( my $in_fh, '<', $filename ) or die "Unable to open $filename for read: $!"; .. close ( $in_fh );
With autodie, that can be simplified to
use autodie; open ( my $in_fh, '<', $filename ); .. close ( $in_fh );
I think that's pretty handy.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.