I don't see why -i is required. If it's not on the command line, then it must be on STDIN, so there's no reason to use -i.
my $input = @ARGV ? shift(@ARGV) : <STDIN>;
That's the approach <ARGV> uses.
In reply to Re^2: How to write a program to read stdin or command line?
by ikegami
in thread How to write a program to read stdin or command line?
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |