Your "if data is piped in" makes things difficult. It's easy to say
if (!@ARGV) {
@ARGV = ("somedefault");
}
while (<>) {
...
}
which will operate on "somedefault" if no filenames are given on the commandline — but that means you'll never get the Perl default of reading from stdin if there aren't any filenames on the commandline.
One possible compromise is to use the -t operator to guess whether stdin is a terminal:
if (!@ARGV && -t STDIN) {
@ARGV = ("somedefault");
}
Which will use "somedefault" if there are no filenames on the commandline and stdin is attached to a terminal, but it will use stdin if there are no filenames and stdin is redirected from a file or a pipe. This is a little magical (maybe annoyingly so), but does what you asked for.