On Sunday, June 30, 2002, at 10:14 , Ankit Gupta wrote:
[..]
I was trying the following through command line
c:\> perl abc.pl folder1\folder2 folder3\folder4
but in script I am just able to get folder1\folder2 where as I need both
folder1\folder2 and folder3\folder4 separately in different variables.
Is there any method to achieve this.
actually several.
a) @ARGV is the array of things passed in from the commandline
so you might start small with something simple like - forgive
my unixisms -
#!/usr/bin/perl -w
use strict;
my $count=0;
for my $arg (@ARGV) {
print "We have \$arg set to $arg as $count in the ARGV\n";
$count++;
}
b) perldoc Getopt::Std
c) perldoc Getopt::Long
some basic demonstration types can be found also at:
Don't PANIC that this looks a bit weird - since I have
code that creates code that we run - it's simpler for
me to do that....
http://www.wetware.com/drieux/pbl/Sys/NextStuff/getOptStd.txt
cf:
http://www.wetware.com/drieux/pbl/Sys/NextStuff/AutoGinCmd.txt
ciao
drieux
---
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|