in reply to Re: Perl Input Parameters for Unix
in thread Perl Input Parameters for Unix

Could you explain in detail how this works exactly? Thank you

Replies are listed 'Best First'.
Re^3: Perl Input Parameters for Unix
by aitap (Curate) on Jul 10, 2012 at 07:13 UTC

    This can work because there is an array called @ARGV, which contains all the command line arguments passed to the perl script (not to the perl itself). See perlvar for more.

    `shift` removes and returns the first element of this array, until none are left (when array is empty, it returns undef), so this `while` loop checks all the command line arguments from left to right (additional `shift`s inside the loop are used to get the parameter next to being processed now). See shift for more.

    Sorry if my advice was wrong.