For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2004 > Looking for a equivalant function in Perl for main(int argc, char *argv[ ])









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Looking for a equivalant function in Perl for main(int argc, char *argv[ ])
Shilpa Arvind

2004-04-28, 4:41 pm

Hi,

In C programming language we have a function which looks like this:

main(int argc, char *argv[ ]).

Is there a equivalant function in Perl. I was looking at @ARGV but i feel it
does not behave the same way as the above function does. I might be wrong.

Thanks in advance
Shilpa


James Edward Gray II

2004-04-28, 4:41 pm

On Apr 28, 2004, at 1:50 PM, Shilpa Arvind wrote:

> Hi,
>
> In C programming language we have a function which looks like this:
>
> main(int argc, char *argv[ ]).
>
> Is there a equivalant function in Perl. I was looking at @ARGV but i
> feel it does not behave the same way as the above function does. I
> might be wrong.


@ARGV does handle command line arguments for Perl, if that's what you
are getting at. It's a full Perl array, so you can easily get the
count, if needed:

my $argc = @ARGV;

Hope that helps.

James

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com