There are two problems with the syntax you used above.
First, the
|| is better written as
or,
although in this particular case, the effect is more or less
the same. A worse problem is that your code will
die
if the program is given an argument that's false, for instance
0.
I'd write something like:
my $argument = @ARGV ? shift : do {
print "Please give an argument: ";
my $arg = <STDIN>;
chomp $arg;
$arg;
};
Abigail