I'd use Getopt::Long (or Getopt::Std, if that's your preference) to tell the program whether the input is on the commandline or not. One convention for this is to expect the input data on the commandline by default, but if a -i (--input) option is present, to read stdin instead.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Need better specs. From you description I can't tell if there's no difference between the two (say, just use the '-p' flag on the command line or the <> operator in the code), or if maybe there is some difference where I might need to test @ARGV to see if there are any arguments before processing STDIN.

The null filehandle <> is special: it can be used to emulate the behavior
of sed and awk. Input from <> comes either from standard input, or from
each file listed on the command line. Here’s how it works: the first
time <> is evaluated, the @ARGV array is checked, and if it is empty,
$ARGV[0] is set to "-", which when opened gives you standard input. The
@ARGV array is then processed as a list of filenames.

Let's see how I can make a response to this unreasonable, unprovable assertion without being unreasonable or irrated.

approach one: the personality appeal

Well, it is not homework. If you knew who I were you would know that I am not in school.

approach two: the common sense approach

To me, the question asked just seems like a question asked. Is there something about this that sounds like homework? How do you distinguish a homework problem from a non-homework problem? You certainly were pretty confident of your assertion.

I'm really rather disappointed in you. You have made some great posts in the time I have seen you here, and now you want to say something that (a) you cannot prove (b) is false.

approach three: the prior evidence approach

If you look at my home node you would see that I have a long long history of posting, and most of these posts show evidence of professional work... which does not preclude returning to school.

the next approach: pure logic

You cannot prove that this is homework. To do so would require evidence that you cannot find. I also cannot prove that this is not homework. To do so would require evidence that I cannot produce.

the final approach: ignore him.

He is making unfounded accusations. Of course, this hurts you in a few ways: (1) it led to a huge number of downvotes (2) it makes you look crooked (3) he might treat you like a person trolling for homework help in the future.

All in all though, what can you do? It's a shame when someone tells a mistruth and has no evidence for it and then insults you in the process. But why stoop to his level? In terms of etiquette, he is acting poorly... he said "no bone for you" --- he's calling you a dog indirectly. He is out to humiliate you. His Perl skills are fantastic as he has shown in his posts. But that does not excuse his illegitimate and hateful attack on you.

Seek a better company than he provides and hope that he will join you there someday.

Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

The fact that you are a professional actually supports my point. It should have been dead easy for you to find how to check for parameters. Homework needs not be assigned by a school. It can be self-assigned, as it should have been in this case. Sounds like you could use a refresher.

There was no malice in my reply. The idea was to influence others not to give an outright answer in order to influence the poster to actually do his own homework.