At 9:10 PM -0700 10/6/09, Slick wrote:
Thanks David.

Got another question that I have been trying to wrap my mind around. About @argv. Now it says from I understand and read it access information from the command prompt. How exactly does it work? Is it it's own database? Or am I mistake, I know this may be a crazy question to ask.

The @ARGV array (case matters) contains the command-line arguments with which the program was called. For example, if you have a Perl program myprog.pl and execute it this way from a command prompt:

        perl myprog.pl command line arguments

then the @ARGV array contains three elements, just as if you had the line

        @ARGV = ( 'command', 'line', 'arguments' );

at the beginning of your program. There is no "database" involved. The @ARGV array is a normal, global array in the main package and can be accessed in your program like any other array.

You can read about @ARGV and many other special Perl variables in the 'perlvar' section of the built-in Perl documentation, available from a shell with

        perldoc perlvar


--
Jim Gibson
j...@gibson.org

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to