Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Doubts of a perl beginner on PERLEMBED

by robin (Chaplain)
on Dec 16, 2005 at 18:31 UTC ( #517323=note: print w/ replies, xml ) Need Help??


in reply to Doubts of a perl beginner on PERLEMBED

(2) My second question is about the third argument in "perl_parse".Some people put it as 2 or 3 or argc. I want to know what it actually means.
The third argument (argc) is simply the number of elements in the fourth argument (argv). This is an array of strings, which corresponds to the arguments you pass to perl on the command line.

In the examples in perlembed, some of them just pass their own command-line arguments through to the Perl interpreter, hence they pass their own argc and argv, while others use a constant array of arguments, and pass its length (which happens to be 3 in one of the examples, because the array is { "", "-e", "0" }, and 2 in another because the array is { "", "power.pl" }.)

(The first element of argv is more or less ignored, which is why these examples use the empty string. I imagine it's used to initialise $0, but I haven't confirmed that. It’s not even used to initialise $0.)

Update: changed ‘argument’ to the less ambiguous ‘element of argv’, in the last sentence.


Comment on Re: Doubts of a perl beginner on PERLEMBED
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://517323]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-12-28 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls