in reply to Ternary Operator for Multiple Arguments Passing

It's because shift is shifting the first element off @ARGV in your first assignment. At that point, $ARGV[1] is undefined. You should try to avoid side-effects when using ternaries. But you don't really need the ternary at all here. A simple or will do.

I would write it as:

my $based_on = $ARGV[0] || 'tp'; my $top = $ARGV[1] || 1;