Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: strawberry win10 no ARGV

by stevieb (Canon)
on Dec 14, 2019 at 22:22 UTC ( [id://11110154]=note: print w/replies, xml ) Need Help??


in reply to strawberry win10 no ARGV

Can you please post your code so we can see what you're trying to do, and how?

Strawberry Perl handles command line arguments perfectly fine. Here's an example:

use warnings; use strict; if (@ARGV != 3){ print "Program requires 3 arguments\n"; exit; } my ($one, $two, $three) = @ARGV; print "arg1: $one, arg2: $two, arg3: $three\n";

output:

> perl def.pl Program requires 3 arguments > perl def.pl 1 2 3 arg1: 1, arg2: 2, arg3: 3

If you require anything more elaborate than sending in a small number of simple args, there's the Getopt::Long distribution.

Replies are listed 'Best First'.
Re^2: strawberry win10 no ARGV
by twyce (Initiate) on Dec 14, 2019 at 22:39 UTC
    I am mostly interested in calling from another script. I've tried qx, backticks, and system. So Eventually I tried simply from the command line, like. "scriptname.pl 09 12 34likj" No dice. My code is basically
    my $i = 0 ; for ( @ARGV ) { $i++ ; print "i:$i for argv $_\n" ; } print "$i is the final index of argv\n" ;
    All my scripts work fine in win7 + activeperl

      your file association is wrong. You need %* after the "%1" in the command your association runs.

        I guess you're joking? Anyhow why can't I call one script from another script and send it @ARGV ?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 05:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found