Hi I wanted to implement both command line argument1, and either piped STDIN (through lone single dash '-') or a filename as argument2, using Getop::Long in Perl. In perldoc it is merely mentioned a little bit "A lone dash on the command line will now be a legal option, and using it will set variable $stdio": (https://perldoc.perl.org/Getopt/Long.html). But this is far from what I can use. I tried the following
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my ($se, $st);
GetOptions("se=s" => \$s, '' => \$st) or die "Usage: $0 -s <tab|space|comma>\n";
$st = <STDIN>;
print "$se\n$st\n";
However $st only returns the first line or should I use a filehandle? Then what if the lone single dash '-' is not there and a filename is specified as argument2? Thanks a lot,