Nicolas Schier wrote: >-while (<>) { >+while (<STDIN>) { That gets rid of all the dangerous and bizarre behaviour. It is `safe' in that sense. However, it would leave the program still accepting extraneous arguments (and now ignoring them). If I were patching the program I'd want to also change it to signal a usage error when extraneous arguments are supplied. (Input checking and good error messages are useful features. Accepting extra arguments and ignoring them is a recipe for users to develop spurious beliefs that extra arguments will do something useful.) This pseudo-patch would add such argument checking:
-) || die "usage: ts [-r] [-i | -s] [-m] [format]\n"; +) && @ARGV <= 1 or die "usage: ts [-r] [-i | -s] [-m] [format]\n"; If you have the argument checking then the patch to change <> to <STDIN> is not strictly necessary, because @ARGV would then always be empty by the time that loop is reached. But it would still be good style to change <> to <STDIN>, to better indicate the program's intended behaviour. >If it is, I would like to include your reasoning into a patch for >upstream, ok? Sure. You may use that text freely. -zefram