open(SCREEN, "+> lkscreen")
|| die "can't open lkscreen: $!";
- open(LOGFILE, "+>> /var/log/applog"
+ open(LOGFILE, "+>> /var/log/applog")
|| die "can't open /var/log/applog: $!";
The first one won't create a new file, and the second one will always
$ myprogram file1 file2 file3
-Can have all its files opened and processed one at a time
+can have all its files opened and processed one at a time
using a construct no more complex than:
while (<>) {
name into pipes. For example, to autoprocess gzipped or compressed
files by decompressing them with I<gzip>:
- @ARGV = map { /^\.(gz|Z)$/ ? "gzip -dc $_ |" : $_ } @ARGV;
+ @ARGV = map { /\.(gz|Z)$/ ? "gzip -dc $_ |" : $_ } @ARGV;
Or, if you have the I<GET> program installed from LWP,
you can fetch URLs before processing them:
"&" but rather with a "&=" combination, then Perl will not create a
completely new descriptor opened to the same place using the dup(2)
system call. Instead, it will just make something of an alias to the
-existing one using the fdopen(3S) library call This is slightly more
+existing one using the fdopen(3S) library call. This is slightly more
parsimonious of systems resources, although this is less a concern
these days. Here's an example of that:
C<< '<' >>, C<< '>' >>, C<< '>>' >>, C<< '|' >> and their variants,
for example:
- open(my $fh, "<:utf8", $fn);
+ open(my $fh, "<:crlf", $fn);
=item *