Next | Trivial Utilities | 79 |
printf $format, $file, $_, $.;
What is in $format?
my $format;
if (defined $opt_F) { $format = $opt_F . "\n"; } else { my %format = ( l => '%s'."\n", h => '%2$s'."\n", q => "", "" => $opt_I || @ARGV > 1 ? "%s: %s\n" : '%2$s'."\n", ); my $fk = ""; $fk .= 'l' if $opt_l; $fk .= 'h' if $opt_h; $fk .= 'q' if $opt_q; $format = $format{$fk}; unless (defined $format) { warn "Incompatible options.\n"; usage(); } }
-F is the only command-line option that I wasn't sure I was going to use
But it cost next to nothing to put it in, so what the heck?
Next | Menu | Copyright © 2012 M. J. Dominus |