open(FILE,'/path/to/file'); print while (); close(FILE); ... open(FILE2,'/path/to/file2'); print while (); close(FILE2); #### #!/usr/bin/perl -w use strict; open(FILE,'/path/to/file') || die $!; print while (); close(FILE); ... open(FILE2,'/path/to/file2') || die $!; print while (); close(FILE2); #### #!/usr/bin/perl -w use strict; use Fatal qw(open close); open(FILE,'/path/to/file'); print while (); close(FILE); ... open(FILE2,'/path/to/file2'); print while (); close(FILE2);