in reply to Re: Make command line argument optional
in thread Make command line argument optional

I was ale to accomplish what I need to do by using the following. Thanks for your help.

my $id = $ARGV[2]; if (not defined $id) { print "$id is not defined"; } else { print "$id is defined"; }

Replies are listed 'Best First'.
Re^3: Make command line argument optional
by huck (Prior) on Jul 10, 2018 at 21:37 UTC

    I suspect you want

    if (not defined $id) { print '$id is not defined';
    Notice the change in quotes, inside double quotes $id will try to interpolate, and it is undefined