Slick wrote:
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.

When you start a program, either via a system() call or via a shell, you can provide arguments to that program. For example, on Windows XP:

    C:\Documents and Settings\dpchrist>echo one two three
    one two three

When I typed the first line ("echo one two three") and pressed the "Enter" key, Command Prompt parsed my input, decided that "echo" was a command, decided that "one", "two", and "three" were arguments, and invoked a system() API call to start the requested program with the provided arguments. Inside "echo", the arguments were made available according to the conventions of the programming language that "echo" was written in. The program was free to use the arguments as desired. In this case, "echo" output the arguments to the console as the second line ("one two three").


Inside a Perl script, arguments are made available as the contents of the @ARGV array. Your script is free to read the size and contents of the @ARGV array using all the capabilities of the Perl programming language, but attempting to change the size and/ or contents of @ARGV will cause problems; @ARGV should be treated as read-only.


(The above explanations are simplified for clarity.)


HTH,

David

--
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