sub usage { my $err = shift and select STDERR; print "usage: $0 [--options] ...\n"; exit $err; } # usage use Getopt::Long qw(:config bundling); my $opt_v = 0; GetOptions ( "help|?" => sub { usage (0); } # OK, STDOUT "v|verbose:1" => \$opt_v, "x|xfsgdft!" => \my $opt_x, ) or usage (1); # FAIL: STDERR #### > some_app --help |& less #### $ perl foo.pl big_file.txt >excerpt.csv Opening file … Analyzing columns … Validating data … Generating CSV … 1 2 3 4 5 Done! $