You may have to parse @ARGV manually depending on how arguments are passed
to your script. For instance, if you script is run as follows:
perl ack --name foo --pkg bar -relno 1234
then @ARGV will contain "--name, foo, --pkg, bar, -relno, 1234," and you
will have to parse the list for the values you need.

On the other hand if the script is run: perl ack foo bar 1234
then @ARGV will be "foo, bar, 1234"

You should look at the GetOpt::Short or GetOpt::Long modules which are part
of the standard perl library.

Try perldoc GetOpt::Long on your command line to view the module doc.

Mimi



contain different values


On 19/06/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
>
>
> I am using @ARGV variable to record the argument passed to my Perl
> script. Now the requirement is that if I don't pass any argument to Perl
> script then it should show me following such output.
>
>
>
> Perl ack
>
> Usage:  ack
>
>               -name
>
>                -pkg
>
>                -relno
>
>
>
> -name, -pkg, -relno are the user friendly option which should be mapped
> to the arguments passed to the Perl script.
>
> So -name should take first argument -pkg should take second argument and
> so on.
>
>
>
> Please help how should I do that.
>
>
>
> Regards
>
> Irfan.
>
>
>
>

Reply via email to