Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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 { "", "" }.)

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-08-08 06:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found