or check for it being defined like this#!/usr/bin/perl use warnings; use strict; $ARGV[0] ||= ''; if ($ARGV[0] eq 'TEST') { print "$ARGV[0]\n"; }
I prefer the second option.#!/usr/bin/perl use warnings; use strict; if (defined($ARGV[0]) && $ARGV[0] eq 'TEST') { print "$ARGV[0]\n"; }
In reply to Re: using $ARGV without arguments
by tcf22
in thread using $ARGV without arguments
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |