diff --git a/bin/awk b/bin/awk index 6cd380a4..68c2f647 100644 --- a/bin/awk +++ b/bin/awk @@ -45,15 +45,15 @@ usage() unless @ARGV; # pipes or even redirections for process control # on broken soi-disant operating systems. -open(SAVE_OUT, ">&STDOUT") || die "can't save stdout: $!"; +open(SAVE_OUT, '>', "&STDOUT") || die "can't save stdout: $!"; die unless defined fileno SAVE_OUT; -open(TMPIN, "> " . ($tmpin = "a2pin.$$")) || -open(TMPIN, "> " . ($tmpin = "/tmp/a2pin.$$")) || +open(TMPIN, '>', ($tmpin = "a2pin.$$")) || +open(TMPIN, '>', ($tmpin = "/tmp/a2pin.$$")) || die "can't find a tmp input file"; -open(TMPOUT,"+> " . ($tmpout = "a2pout.$$")) || -open(TMPOUT,"+> " . ($tmpout = "/tmp/a2pout.$$")) || +open(TMPOUT, "+>", ($tmpout = "a2pout.$$")) || +open(TMPOUT, "+>" , ($tmpout = "/tmp/a2pout.$$")) || die "can't find a tmp output file"; # And some people think getopts does everything. Sheesh. @@ -105,7 +105,7 @@ unshift @ARGV, @vargs; # put back var=val statements close(TMPIN) || die "can't close $tmpin: $!"; -open(STDOUT, ">&TMPOUT") || die "can't dup to $tmpout: $!"; +open(STDOUT, '>', "&TMPOUT") || die "can't dup to $tmpout: $!"; $| = 1; system 'a2p', @nargs; @@ -126,7 +126,7 @@ die "empty program" unless -s $tmpout; seek(TMPOUT, 0, 0) || die "can't rewind $tmpout: $!"; $program = do { local $/; }; close(TMPOUT) || die "can't close $tmpout: $!"; -open(STDOUT, ">&SAVE_OUT") || die "can't restore stdout: $!"; +open(STDOUT, '>', "&SAVE_OUT") || die "can't restore stdout: $!"; eval qq{ no strict; diff --git a/bin/fold b/bin/fold index 2d0adbb7..9d0b2b98 100644 --- a/bin/fold +++ b/bin/fold @@ -117,7 +117,7 @@ sub fold_file { my($column, $char, $output); $column = 0; - open(INPUT, $filename) || die "Cannot open $filename: $!\n"; + open(INPUT, '<', $filename) || die "Cannot open $filename: $!\n"; # the following hack allows us to dispense with the # slow getc() and the hairy adj_col() code because we diff --git a/bin/grep b/bin/grep index 64398f44..c19153c7 100644 --- a/bin/grep +++ b/bin/grep @@ -145,7 +145,7 @@ sub parse_args { my $no_re = $opt{F} || ($Me =~ /\bfgrep\b/); if ($opt{f}) { # -f patfile - open(PATFILE, $opt{f}) or die qq($Me: Can't open '$opt{f}': $!); + open(PATFILE, '<', $opt{f}) or die qq($Me: Can't open '$opt{f}': $!); # make sure each pattern in file is valid while ( defined($pattern = ) ) { @@ -337,7 +337,7 @@ FILE: while (defined ($file = shift(@_))) { warn "$Me: checking $file\n" if $opt->{T}; - unless (open(FILE, $file)) { + unless (open(FILE, '<', $file)) { unless ($opt->{'q'}) { warn "$Me: $file: $!\n"; $Errors++; diff --git a/bin/hangman b/bin/hangman index 3ac72037..f17eff1c 100644 --- a/bin/hangman +++ b/bin/hangman @@ -75,7 +75,7 @@ sub get_a_word { my( $line_num ) = 1; my( $random ) = rand(); my( $val ) = int( $random * 9151 ) + 1; - open( FILE, "wordlist.txt" ) || die "$!, stopped"; + open( FILE, '<', "wordlist.txt" ) || die "$!, stopped"; while( ) { if( $line_num == $val ) { $word = $_; diff --git a/bin/look b/bin/look index 1c06dd75..e3e77bc2 100644 --- a/bin/look +++ b/bin/look @@ -69,7 +69,7 @@ $search = squish($search); FILE: for my $file (@dicts) { - unless (open(DICT, "< $file")) { + unless (open(DICT, '<', $file)) { warn "$0: can't open $file: $!\n" unless $def_dict; next FILE; } diff --git a/bin/par b/bin/par index 43077631..28024879 100644 --- a/bin/par +++ b/bin/par @@ -230,7 +230,7 @@ find sub { FILE # Inline file as here-doc. - open F, "< $_" or die "Couldn't open '$_': $!"; + open F, '<', $_ or die "Couldn't open '$_': $!"; binmode F; if ($bin) { local $_; diff --git a/bin/shar b/bin/shar index 2551dd42..02e6c873 100644 --- a/bin/shar +++ b/bin/shar @@ -34,7 +34,7 @@ $av0 =~ s@.*/@@; # Do work. $dirty = 0; ARGUMENT: foreach $f ( @ARGV ) { - if ( ! open(FH, $f) ) { + if ( ! open(FH, '<', $f) ) { warn "$av0: can't open $f, $!\n"; next ARGUMENT; } diff --git a/bin/split b/bin/split index 86dbeb49..bc37253c 100644 --- a/bin/split +++ b/bin/split @@ -71,7 +71,7 @@ sub nextfile { # MS-DOS: $curname = "$prefix." . $curext; $curname = $prefix . $curext; - open (FH, ">$curname") or die "$me: Can't open $curname: $!\n"; + open (FH, '>', $curname) or die "$me: Can't open $curname: $!\n"; binmode(FH); return *FH; } @@ -105,7 +105,7 @@ clue if $opt{"?"}; # heeeeeeeeeeelp! my $infile = (defined $ARGV[0] ? $ARGV[0] : "-"); my $prefix = ($ARGV[1] ? "$ARGV[1]" : "x"); -open (INFILE, "$infile") || die "$me: Can't open $infile: $!\n"; +open (INFILE, '<', $infile) || die "$me: Can't open $infile: $!\n"; binmode(INFILE); ## Byte operations. if ($opt{b} and (! $opt{p}) and (! $opt{l}) and (! $opt{"?"})) { diff --git a/bin/sum b/bin/sum index a3dff279..5e183df4 100644 --- a/bin/sum +++ b/bin/sum @@ -33,7 +33,7 @@ $opt_o = 1 unless ( $0 =~ /cksum$/ || defined($opt_o) ); my($exitval) = 0; # return value foreach (@ARGV) { - open(IN,$_) || die "Can't open file for reading:$!"; + open(IN, '<', $_) || die "Can't open file for reading:$!"; my($rval,$crc,$len)= ($opt_o==0)?&crc32(\*IN):($opt_o==1)?&sum1(\*IN):&sum2(\*IN); unless ( defined($rval) && ($rval == 0) ) { diff --git a/bin/uuencode b/bin/uuencode index 4297a46a..d26230d1 100644 --- a/bin/uuencode +++ b/bin/uuencode @@ -80,7 +80,7 @@ sub encode($$) { printf "begin %03o $destination\n", $mode || 0644; local *INPUT; - open(INPUT, "< $source") || die "can't open $source: $!"; + open(INPUT, '<', $source) || die "can't open $source: $!"; binmode(INPUT); # winsop my $block; diff --git a/bin/wc b/bin/wc index e7504340..555e09ad 100644 --- a/bin/wc +++ b/bin/wc @@ -230,7 +230,7 @@ sub wc_fh { if (@ARGV) { foreach my $filename (@ARGV) { - open(FH, "< $filename") or die "cannot open $filename: $!\n"; + open(FH, '<', $filename) or die "cannot open $filename: $!\n"; wc_fh(\*FH, $filename); close(FH); } diff --git a/bin/what b/bin/what index 8926f5ee..0d31ebdf 100644 --- a/bin/what +++ b/bin/what @@ -31,7 +31,7 @@ else { foreach $file (@ARGV) { - open(FILE, "<$file") or die "Unable to read $file: $!"; + open(FILE, '<', $file) or die "Unable to read $file: $!"; printWhat(\*FILE,$file,$stop); close FILE; }