open( FH , "+<" , $file ) or die "Unable to open '".$file."' - $!\n";
Btw. you really should use lexical variables instead of barewords for your filehandles. Especially if you use something obvious like 'FH'.
(and with slightly improved style)open( my $fh , "+<" , $file ) or die "Unable to open '".$file."' - $!\n";
open my $fh, '+<', $file or die "Unable to open '$file': $!\n";
Using bareword symbols to refer to file handles is particularly evil because they are global, and you have no idea if that symbol already points to some other file handle. You can mitigate some of that risk by localizing the symbol first, but that's pretty ugly. Since Perl 5.6, you can use an undefined scalar variable as a lexical reference to an anonymous filehandle. Alternatively, see the IO::Handle or IO::File or FileHandle modules for an object-oriented approach.
In reply to Re: Bareword "SEEK_END" not allowed while "strict subs" in use
by Monk::Thomas
in thread Bareword "SEEK_END" not allowed while "strict subs" in use
by thanos1983
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |