I have a script that asks a bunch of questions using the following method for input:
So for example, if the questions asked for name, age, & color (in that order)... I want to be able to easily convert $ARGV[0] into the input expected by <>.
So, just for clarification, the user can run the script as is, answer a bunch of questions, and be done... OR they can know the order of the questions, and put answers to as many as they want in the command line arguments
Irony is that Im asking if there is a way to place $ARGV[0] inside the <> instead of letting <> try to read the file specified by $ARGV[0] like it does by default
You can probably test if you receive any command-line arguments. If so, then read using cmdline arguments, otherwise read <>. I can think of a way to make a facade that makes <> read from the @ARGV, but I cannot think of much justification for that complexity for the scenarios I can imagine. Let's try with some simpler methods first, then if they don't satisfy your requirements then I tell you how to do it.
I am running a perl script and reading the arguments passed to the script as below..... resembles more arguments.
java weblogic.WLST /web/update.py 34 56 ....
I am trying to print the arguments passed to the update.py script as below
for arg in sys.argv:
print "other args:", arg... (1 Reply)
Hello folks!
While "sedding" about again, I ran into this little conundrum du jour:#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
@ARGV = ('./afile.dat', './*.txt');
$^I = '';
while (<>)
{
s/Twinkies/Dinner/g;
print;
}When run, perl complains,...but, of... (2 Replies)
Hello folks!
While "sedding" about again, I ran into this little conundrum du jour:#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
@ARGV = ('./afile.dat', './*.txt');
$^I = '';
while (<>)
{
s/Twinkies/Dinner/g;
print;
}When run, perl complains,...but, of... (1 Reply)
Hi ,
I need to match module data_tx_dig (
I tried matching
~m/module(\s+)ARGV(\s+)\(/ --> (generic code)but is not working.The same is able to match when i provide hardcoded value instead of passing from the command line.
~m/module(\s+)data_tx_dig(\s+)\(/ -->(hardcoded code).Please help me... (8 Replies)
All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address).
I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
Hello
I have simple script that will accept as arg string like this :
".../foo/blah/,.../.../foo1/,.../blah"
now perl automatically removes the slashes "/" , I can't escape the slashes in the input I have to control on it
so how can I force perl to not touch this slashes?
Thanks ... (5 Replies)
Hi,
I run this utility very frequently. This utility displays some 5 options and again inturn these options have few more option to select.
For Eg : It looks like this
1. User Control
2. Locking and Waiting Statistics
3. Block Access
4. Record Locking Table
5. ... (1 Reply)