The role of the argv array

Source: Internet
Author: User

There is a problem with developing Perl scripts today: The code in the samples given by Qualcomm is judged by the number of elements in the argv array, with the following code:

Sub parsearguments{# Assume failure my $RC=false; My $Txt=""; My $Help="syntax:perl grep_isf.pl <Input_ISF_File.isf> <string_to_be_searched> \ n"    . "eg:perl grep_isf.pl s1.isf \ "Mc_reset|jammer in Max bin\" \ n"; if($ #ARGV <0) {print"\n$help\n"; return$RC; } My $ISFFileName= $ARGV [0]; if($ISFFileName eq"") {$Txt="Invalid ISF file name\n\n". $Help; Print"\n$txt"; return$RC; } $ISFAbsolutePath=Getpathfromscript (); if($ISFAbsolutePath eq"") {$Txt="Invalid ISF file name\n\n". $Help; Print"\n$txt"; return$RC; }   Else{$ISFAbsolutePath.=$ISFFileName; } $SearchString= $ARGV [1]; if($SearchString eq"") {$Txt="Invalid Search string\n\n". $Help; Print"\n$txt"; return$RC; } # Success $RC=true; return$RC;}

But exhausted a lifetime also did not find argv statement, this time Guo Hong ran over and I complained that this thing can not run, I looked up, just found Shia.

ARGV is actually one of the default two parameters of the main function, and the details of the instruction are stored in the array.

For example: We wrote the hello.exe is generally run directly, without adding any parameters. However, as a qualified exe, it is possible to add parameters through the command line, such as we can do: Hello.exe a b c d E

So the contents of the argv array are stored as follows:

argv[0] = hello.exe;

ARGV[1] = A;

ARGV[2] = b;

ARGV[3] = c;

ARGV[4] = D;

ARGV[5] = e;

So I think the relationship between the automation script and the QXDM should be connected by command-line arguments and commands. Think again in the afternoon, go to dinner

The role of the argv array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.