On 7/27/10 Tue Jul 27, 2010 7:28 AM, "Sooraj S"
scribbled:
> I have a script which copies files from local machine to remote
> machine.
> parameteres : "-d" for directories, "-f" for files..
>
> GetOptions ('d=s{,}' => \...@dir,
> 'f=s{,}' => \...@fil);
>
> I want one more rename
Hi,
I have a script which copies files from local machine to remote
machine.
parameteres : "-d" for directories, "-f" for files..
GetOptions ('d=s{,}' => \...@dir,
'f=s{,}' => \...@fil);
I want one more rename option "-r" which should be used only if "-d"
is specified ie only for dir
>
>
> > Hi,
> > i am using the Getopt::Std package in my code.
> >
> >
> > use Getopt::Std;
> >
> > getopts('s:');
> >
> > $a = $opt_s
By the way, you don't really need to assign the $opt_x variables to a new
variable. $opt_s will be persistant, unless you run getopt again, which would
b
Put quotes around your arguments. Use single quotes if you are not doing
variable substitution, and double quotes if otherwise.
That is:
my_program.pl -s 'will[1]' "$will"
__
William Ampeh (x3939)
Federal Reserve Board
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For a
> Hi,
> i am using the Getopt::Std package in my code.
>
>
> use Getopt::Std;
>
> getopts('s:');
>
> $a = $opt_s
>
>
> this is how i run my program from command line "
>
> > my_program.pl -s pattern
>
> now if "pattern" is something like abcd[12] how do i
> make my program accept the in
Hi,
i am using the Getopt::Std package in my code.
use Getopt::Std;
getopts('s:');
$a = $opt_s
this is how i run my program from command line "
> my_program.pl -s pattern
now if "pattern" is something like abcd[12] how do i
make my program accept the index 12 as a part of the
string for o
> > Since I anticipate using this module in multiple programs,
> > I'd like to keep the parameter list as generic
> > as possible (in terms of order and requirements).
>
> That is a worthy cause, but remember that the arguments
> that will be passed in need to be passed in a specific order:
>
>
On Thursday, Nov 20, 2003, at 11:10 US/Pacific, Freimuth,Robert wrote:
[..]
Excellent suggestion! I should have thought of that before.
(I can tell I'm tired...) Passing a hash would solve both the
required/optional and parameter order problem.
[..]
hash is your friend. Hash References are Coole
On Wednesday, Nov 19, 2003, at 15:27 US/Pacific, Freimuth,Robert wrote:
I have a subroutine that is contained within its own module and
package. It
currently takes 7 different arguments, but only 2 of them are required
because I can set defaults for the other 5.
let me see if I understand your i
I don't think you'll quite be able to have it be as modular as you would like
since it creates globals.
I'd recommend looking at the package, since it is in plain text, make a copy
and modify it to your needs.
But since you have to deal with the variables it sets anyway, it seems like
you coul
Hello,
I have a subroutine that is contained within its own module and package. It
currently takes 7 different arguments, but only 2 of them are required
because I can set defaults for the other 5. Since I anticipate using this
module in multiple programs, I'd like to keep the parameter list as
, "Mother!"
Welcome! I would imagine that with your background learning Perl will
mostly be a matter of getting to grips with the syntax, idioms,
idiosycrasies and learning what's already available in the form of
modules both in the core and in CPAN.
> I would really like to be us
On Oct 25, Caroline Allen said:
>I would really like to be using "getopt," and I'm failing. I can't
Others have posted getopt-related code, so I'll skip this.
>I can't help wondering: does the Perl community have the same distaste
>for non-positional a
coping issues are very familiar to me, not to
> mention the automatic memory management. Oh gosh, then there's Basic and
> its own way of string handling (I was doing a lot of work in VB). As one
> of my clients, Daffy Duck, would say, "Mother!"
>
> I would really lik
cript -
now history - the pod is not complete.)
Check thes modules out on CPAN - they both
have good documentation.
Aloha => Beau.
-Original Message-
From: Caroline Allen [mailto:callen@;wbfa.com]
Sent: Friday, October 25, 2002 4:34 PM
To: [EMAIL PROTECTED]
Subject: using getopt()
Hi,
utomatic memory management. Oh gosh, then there's Basic and
its own way of string handling (I was doing a lot of work in VB). As one
of my clients, Daffy Duck, would say, "Mother!"
I would really like to be using "getopt," and I'm failing. I can't
submit examp
Samuelsson (PAC)
Cc: [EMAIL PROTECTED]
Subject: Re: Using GetOpt::Long
On Thu, Sep 19, 2002 at 10:02:32AM +0200, David Samuelsson (PAC) wrote:
> I want it so it will execute the subs in the order according to the lines
> when i start the scrippt, and i will try to keep to default -value cause
On Thu, Sep 19, 2002 at 10:02:32AM +0200, David Samuelsson (PAC) wrote:
> I want it so it will execute the subs in the order according to the lines
> when i start the scrippt, and i will try to keep to default -value cause
> the scipt will probably be used by others aswell so no double --.
You do
> -Original Message-
> From: David Samuelsson (PAC)
> [mailto:[EMAIL PROTECTED]]
> Sent: 19 September 2002 09:03
> To: 'Jeff AA'; [EMAIL PROTECTED]
> Subject: RE: Using GetOpt::Long
>
>
> I want it so it will execute the subs in the order accor
PROTECTED]
Subject: RE: Using GetOpt::Long
> -Original Message-
> From: David Samuelsson (PAC)
> [mailto:[EMAIL PROTECTED]]
> Sent: 19 September 2002 08:09
> To: '[EMAIL PROTECTED]'
> Subject: Using GetOpt::Long
>
>
> I found this module was a part off
> -Original Message-
> From: David Samuelsson (PAC)
> [mailto:[EMAIL PROTECTED]]
> Sent: 19 September 2002 08:09
> To: '[EMAIL PROTECTED]'
> Subject: Using GetOpt::Long
>
>
> I found this module was a part off the package, and tried it
> out,
I found this module was a part off the package, and tried it out, it works as i want.
I have some troubles though, i am going to use quite a lot of sub routines in my
scrip, how can i define and structure so that the commandline switches will actually
be the subs executed?
for example i have t
On Wed, Jul 04, 2001 at 09:54:17AM -0500, [EMAIL PROTECTED] wrote:
[snip]
> script -nf domain.com client
>
> but when i try mixing the two up, or trying something like:
>
> script -f client -n domain.com
>
> i still get the incorrect output. i am sure this is because i am setting
> the values b
>The perldoc for getopt::std states:
>Hash keys will be x (where x is the switch name) with key
>values the value of the argument or 1 if no argument is
>specified
This is true for getopt, but not getopts.
Getopts puts the parameter in the hash table (I am working on 5.005_03
built for aix )
per
> Clean this up as:
> if ($option{n}) {
> $domain = $option{n}
> add();
> }
>
> Don't use ARGV once you have used getopt (or getopts). The hash you
> specify to the option getter
> creates the keys as the flags and the values as the associated parameter.
>
> #if -f, then set $path
> if
>
> To: "Perl Discuss" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 04, 2001 3:54 PM
> Subject: using getopt specifying ARGV values per flag
>
>
> > my script is as follows:
> >
> > #!/usr/bin/perl -w
> >
> > use strict;
> > m
use Getopt::Std;
?
- Original Message -
From: <[EMAIL PROTECTED]>
To: "Perl Discuss" <[EMAIL PROTECTED]>
Sent: Wednesday, July 04, 2001 3:54 PM
Subject: using getopt specifying ARGV values per flag
> my script is as follows:
>
> #!/usr/bin/perl -w
>
my script is as follows:
#!/usr/bin/perl -w
use strict;
my $domain;
my $path;
my %option;
getopts("nhfc",\%option);
i have 4 options set.
typically two will be used together n and f, however i am sure that end
users will type in 'script -fn' and 'script -nf'. my concern is that each
of these
28 matches
Mail list logo