Re: doubts in using Getopt in perl

2010-07-27 Thread Jim Gibson
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

doubts in using Getopt in perl

2010-07-27 Thread Sooraj S
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

Re: Using Getopt::Std

2004-01-13 Thread Hacksaw
> > > > 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

Re: Using Getopt::Std

2004-01-13 Thread William.Ampeh
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

Re: Using Getopt::Std

2004-01-13 Thread Wiggins d Anconia
> 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

Using Getopt::Std

2004-01-13 Thread Perl
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

RE: using Getopt with subroutines

2003-11-21 Thread Freimuth,Robert
> > 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: > >

Re: using Getopt with subroutines

2003-11-20 Thread drieux
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

Re: using Getopt with subroutines

2003-11-20 Thread drieux
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

Re: using Getopt with subroutines

2003-11-20 Thread Hacksaw
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

using Getopt with subroutines

2003-11-20 Thread Freimuth,Robert
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

Re: using getopt()

2002-10-26 Thread Paul Johnson
, "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

Re: using getopt()

2002-10-25 Thread Jeff 'japhy' Pinyan
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

Re: using getopt()

2002-10-25 Thread John W. Krahn
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

RE: using getopt()

2002-10-25 Thread Beau E. Cox
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,

using getopt()

2002-10-25 Thread Caroline Allen
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

RE: Using GetOpt::Long

2002-09-19 Thread David Samuelsson (PAC)
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

Re: Using GetOpt::Long

2002-09-19 Thread Michael Fowler
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

RE: Using GetOpt::Long

2002-09-19 Thread Jeff AA
> -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

RE: Using GetOpt::Long

2002-09-19 Thread David Samuelsson (PAC)
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

RE: Using GetOpt::Long

2002-09-19 Thread Jeff AA
> -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,

Using GetOpt::Long

2002-09-18 Thread David Samuelsson (PAC)
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

Re: using getopt specifying ARGV values per flag

2001-07-06 Thread Michael Fowler
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

Re: Using getopt::std return hash with value of 1 rather than argument

2001-07-05 Thread Craig Moynes/Markham/IBM
>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

Using getopt::std return hash with value of 1 rather than argument

2001-07-05 Thread charles
> 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

Re: using getopt specifying ARGV values per flag

2001-07-04 Thread charles
> > 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

Re: using getopt specifying ARGV values per flag

2001-07-04 Thread Pierre Smolarek
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 >

using getopt specifying ARGV values per flag

2001-07-04 Thread charles
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