Closed Thread
Results 1 to 4 of 4

Thread: Arguments in Perl

  1. #1
    smith is offline Programmer
    Join Date
    Jun 2006
    Posts
    153
    Rep Power
    0

    Arguments in Perl

    How do I accept and manipulate arguments in PERL?

    ./perlscript.pl $arg1 $arg2


    ???
    Code:
    for (int i;;) {
       cout << "Smith";
    }

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

  4. #3
    The Fear Guest
    Hi.
    $argv1,$argv2,...
    all in @ARGV.
    example:
    ./perl sample.pl $argv1 $argv2
    @ARGV = $argv1,$argv2
    $ARGV[0] = $argv1
    $ARGV[1] = $argv2

    #Good luck

  5. #4
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0
    Quote Originally Posted by The Fear View Post
    Hi.
    $argv1,$argv2,...
    all in @ARGV.
    example:
    ./perl sample.pl $argv1 $argv2
    @ARGV = $argv1,$argv2
    $ARGV[0] = $argv1
    $ARGV[1] = $argv2

    #Good luck
    The above code is not quite correct. Perl sends the arguments to the program in the @ARGV array. You get them back out of the @ARGV array like so:


    Code:
    my ($arg1,$arg2) = @ARGV;
    or:

    Code:
    my $arg1 = $ARGV[0];
    my $arg2 = $ARGV[1];

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to run process with arguments
    By 051r151 in forum C# Programming
    Replies: 1
    Last Post: 01-10-2010, 04:29 PM
  2. i am confused with arguments
    By Siten0308 in forum C# Programming
    Replies: 10
    Last Post: 08-09-2008, 11:13 AM
  3. Arguments
    By Sionofdarkness in forum Java Help
    Replies: 8
    Last Post: 08-23-2006, 07:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts