in reply to Re: how to deal with incorrect command line argument
in thread how to deal with incorrect command line argument

Thanks my man, does the trick. May I ask a few questions on your solution though... I am going to comment it on your code and maybe you can correct me where I am wrong.
my @array; # this an array to store the good arguments for (@ARGV) { # for the argumets array if (-e) { # if the file exists push @array, $_;# push the file that exists onto the @array # why use $_ here? next; # what purpose has this } warn qq{"$_" doesn't exist!}; } @ARGV = @array;
I Appreciate the time you took to answer my question to man.

Replies are listed 'Best First'.
Re^3: how to deal with incorrect command line argument
by Kenosis (Priest) on Oct 30, 2013 at 22:37 UTC

    You're most welcome! Am glad it helped.

    You're commenting is correct. You asked, "why use $_ here?" Because Perls default scalar ($_) is implicitly used in the for loop that's iterating through the elements of @ARGV. Note, also, that Perl's default scalar is also implicitly used in the expression if (-e) { as that expression is equivalent to if (-e $_) {.

    The purpose of next is to get the next element of @ARGV, otherwise a warn would occur.