http://www.perlmonks.org?node_id=674327


in reply to Stream and Atom flexibility

You could do something like

if (@ARGV) { process($_) for @ARGV; } else { while (<>) { process($_); } }
where sub process does the real work.