Hi Rajesh,
On Wed, 16 May 2012 16:11:13 +0530
Rajesh Saha wrote:
> Hi,
>
> Sorry for one typo. Read "GetOptions" in place of "Getoptions" .
>
> Regards,
> Rajesh
>
>
>
Here is how I do it:
#! /usr/bin/perl
use strict;
use warnings;
u
On Wed, May 16, 2012 at 10:56:59AM +, Michael Brader wrote:
> Hi,
Hello:
> Your problem is that Getopt::Long is consuming your -help as
> the argument to -abc before it can be recognised. You might be
> able to do something with the other Getopt::* modules, but the
> followin
Hi,
Your problem is that Getopt::Long is consuming your -help as the argument to
-abc before it can be recognised. You might be able to do something with the
other Getopt::* modules, but the following piece of code will do what you want
if you really need it:
use List::MoreUtils qw(any);
use
Hi,
Sorry for one typo. Read "GetOptions" in place of "Getoptions" .
Regards,
Rajesh
On Wed, May 16, 2012 at 2:39 PM, Rajesh Saha wrote:
> Hi,
>
> In my program, I am using the module Getopt::Long
>
> My intension is that if the user chooses "--h
Hi,
In my program, I am using the module Getopt::Long
My intension is that if the user chooses "--help", the program should show
the help message without bothering whether other options has been used or
not.
My program (say, test.pl) :
use Getopt::Long
my $abc;
my $help;
Getoption
On Sat, 22 Oct 2011 11:58:38 +1300, newbie01 perl wrote:
> Am just trying to port 1:1. Quite painful trying to figure out how to
> get awk-like behavior in Perl especially when trying to do some
> calculation on some specific fields.
Awk is Perl's closest ancestor on the evolutionary tree, from on
Hi Brandon,
Thanks for your response.
Getopt::Std seems to be the simplest one, so am tryiing that one out first
:-) Am just trying to port 1:1. Quite painful trying to figure out how to
get awk-like behavior in Perl especially when trying to do some calculation
on some specific fields.
I
On Thu, Oct 20, 2011 at 11:45 PM, newbie01 perl wrote:
> Playing around with Getopt::Std as am trying to convert a UNIX
> Korn Shell Script to a Perl script.
>
> Is it possible to check for what are the values for opterr,
> optarg, optind? How? :(-
There are many Getopt:: packag
Hi all,
Playing around with Getopt::Std as am trying to convert a UNIX Korn Shell
Script to a Perl script.
Is it possible to check for what are the values for opterr, optarg, optind?
How? :(-
I've been Googling for quite sometime now and can't find an example of Perl
scripts that
hat your problem
was just from reading your message. :)
It looks like your problem is passing the value of $age instead of a
reference to $age. In order for the Getopt::Long module to modify your
$age variable it needs a reference to it:
use strict;
use warnings;
use Getopt::Long;
my $age;
Hello All,
Why shouldn't this work?
use Getopt::Long;
#$debug = 0;
$result = GetOptions("age=i" => $age);
if ($age) {print "Input age is $age years"; }
Emeka
--
*Satajanus Nig. Ltd
*
On 7/29/10 Thu Jul 29, 2010 1:17 AM, "Sooraj S"
scribbled:
> Hi,
>
> I am using Getopt::Long to accept the command line arguments.
>
> Logic
> -
> I have two mandatory options.
> 1.mod1_num
> 2.mod2_num
>
> Both of them can accept
Hi,
I am using Getopt::Long to accept the command line arguments.
Logic
-
I have two mandatory options.
1.mod1_num
2.mod2_num
Both of them can accept either a 3digit number or another parameter
"preserve" which inturn accepts a 3digit number.
eg: my_script -mod1_num 123 -mo
'f=s{,}' => \...@fil);
>
> I want one more rename option "-r" which should be used only if "-d"
> is specified ie only for directories... Please help me..
>
Which Getopt module are you using? (there are 91 on CPAN). The syntax looks
like Ge
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,
use strict;
use warnings;
use Getopt::Long;
my %hash;
GetOptions(\%hash, "first=s", "second|s=s", "third=i");
print $hash{first}, $hash{second}, $hash{third}, "\n";
--
Octavian
- Original Message -
From: "Unknown User"
To:
um,
I am pretty sure getopt::long keeps all input data in a hash, does
anybody know whether i can use that hash itself in my code, and if so,
how?
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On Thu, Jun 17, 2010 at 6:50 AM, Shawn H Corey wrote:
> On 10-06-17 02:36 AM, Unknown User wrote:
>
>> I have the following code:
>>
>> GetOptions(
>>"n|name=s" => \$name,
>>"a|age=i" => \$age,
>>"s|sex=s" => \$sex,
>> ) || die "Bad options\n";;
>>
>
> But they are comp
that.
>>
>> What would be the correct method to die if one of the options is not
>> complete?
>>
>
> But they are complete. 'name' is placed in $name, '-a' is placed in $sex,
> and @ARGV is left with ( '20' ).
snip
Good poi
On 10-06-17 02:36 AM, Unknown User wrote:
I have the following code:
GetOptions(
"n|name=s" => \$name,
"a|age=i" => \$age,
"s|sex=s" => \$sex,
) || die "Bad options\n";;
GetOptions(
"name=s" =>\$name,
"age=i" => \$age,
"sex=s" => \
hat i expected this code to do is to die if a bad option was given,
> say -s without an arguement, as in ./myprog -n name -s -a 20
> However, it does not do that.
>
> What would be the correct method to die if one of the options is not complete?
GetOptions should print a warning and
I have the following code:
GetOptions(
"n|name=s" => \$name,
"a|age=i" => \$age,
"s|sex=s" => \$sex,
) || die "Bad options\n";;
What i expected this code to do is to die if a bad option was given,
say -s without an arguement, as in ./myprog -n name -s -a 20
However, it d
Mr. Shawn H. Corey wrote:
On Tue, 2008-08-05 at 08:57 +0200, rafailowski wrote:
Thx but adding __END__ return me this error, anyway the problem is solve
with a BEGIN block (cf.Rob Dixon).
$ perl test.pl --log-level=debug
Name "main::STDLOG" used only once: possible typo at
/usr/local/share
On Tue, 2008-08-05 at 08:57 +0200, rafailowski wrote:
> Thx but adding __END__ return me this error, anyway the problem is solve
> with a BEGIN block (cf.Rob Dixon).
>
> $ perl test.pl --log-level=debug
> Name "main::STDLOG" used only once: possible typo at
> /usr/local/share/perl/5.10.0/Log/Std
} stay undef and
print $cmd_args_ref->{"log_level"}; return the good value.
I don't understand why in : use Log::StdLog {...}, the value of
$cmd_args_ref->{"log_level"} stay always undef???
Sorry, I was thinking about the problem correctly. Try:
#!/usr/
Rob Dixon wrote:
rafailowski wrote:
I have a problem with Getopt::Long and Log::StdLog.
An example script, i always have the following error :
Use of uninitialized value in hash element at
/usr/local/share/perl/5.10.0/Log/StdLog.pm line 57
level => $cmd_args_ref->{"log_level&
of
> > $cmd_args_ref->{"log_level"} stay always undef???
> >
> >
>
> Sorry, I was thinking about the problem correctly. Try:
>
> #!/usr/bin/perl
> use Getopt::Long;
> use Log::StdLog;
>
> my %cmd_args = ();
> my $cmd_args_ref = \%cm
rafailowski wrote:
>
> I have a problem with Getopt::Long and Log::StdLog.
>
> An example script, i always have the following error :
> Use of uninitialized value in hash element at
> /usr/local/share/perl/5.10.0/Log/StdLog.pm line 57
>
> level => $cmd_args_ref->
rint $cmd_args_ref->{"log_level"}; return the good value.
>
> I don't understand why in : use Log::StdLog {...}, the value of
> $cmd_args_ref->{"log_level"} stay always undef???
>
>
Sorry, I was thinking about the problem correctly. Try:
#!/usr/bin/pe
Mr. Shawn H. Corey wrote:
On Tue, 2008-08-05 at 01:05 +0200, rafailowski wrote:
Hi all,
I have a problem with Getopt::Long and Log::StdLog.
An example script, i always have the following error :
Use of uninitialized value in hash element at
/usr/local/share/perl/5.10.0/Log/StdLog.pm line
On Tue, 2008-08-05 at 01:05 +0200, rafailowski wrote:
> Hi all,
>
> I have a problem with Getopt::Long and Log::StdLog.
>
> An example script, i always have the following error :
> Use of uninitialized value in hash element at
> /usr/local/share/perl/5.10.0/Log/StdLog.
Hi all,
I have a problem with Getopt::Long and Log::StdLog.
An example script, i always have the following error :
Use of uninitialized value in hash element at
/usr/local/share/perl/5.10.0/Log/StdLog.pm line 57
level => $cmd_args_ref->{"log_level"} is always unde
John W.Krahn <[EMAIL PROTECTED]> writes:
> On Friday 14 December 2007 09:09, [EMAIL PROTECTED] wrote:
>>
>> I want a warning message without having to do special coding with
>> Getopt::Std.
>
> Getopt is one of those itches that a lot of people have
On Friday 14 December 2007 09:09, [EMAIL PROTECTED] wrote:
>
> I want a warning message without having to do special coding with
> Getopt::Std.
Getopt is one of those itches that a lot of people have felt like
scratching:
http://search.cpan.org/search?query=getopt&mode=module
If G
I want a warning message without having to do special coding with
Getopt::Std.
I'd like for options passed to getops() with the (:)
colon to give a warning message or even possibly die (Haven't
decided that yet) if no argument accompanies them.
But first: The Getopt::Std documentati
Em (On) Wed, Jun 13, 2007 at 09:29:27AM -0400, John Peacock escreveu (wrote):
> The Kurila project is a fork of Perl5 without the strict backwards
> compatibility required of v5.10.0, as a theoretical experiment. You'll note
> now that under CPAN, it shows up as
Is CPAN (Comprehensive __Perl__
Mumia W. wrote:
I don't know what is going on. It smells like an attempt to compromise
people's systems, although it could be a mistake.
Then maybe you should use Google or even look at the distro, before
making wild accusations:
http://www.nntp.perl.org/group/perl.perl5.porters/2007/04/msg1
On 06/13/2007 08:29 AM, John Peacock wrote:
Mumia W. wrote:
I don't know what is going on. It smells like an attempt to compromise
people's systems, although it could be a mistake.
Then maybe you should use Google or even look at the distro, before
making wild accusations:
http://www.nntp.p
Em (On) Wed, Jun 13, 2007 at 09:03:09AM +0100, Jorge Almeida escreveu (wrote):
> http://search.cpan.org/search?m=module&q=getopt&s=21
What is this Perl Kurila? and why is this (apparently) creating conflicts
with some namespaces?
http://search.cpan.org/~tty/kurila-0_
On 06/13/2007 03:03 AM, Jorge Almeida wrote:
http://search.cpan.org/search?m=module&q=getopt&s=21
Hmm: http://search.cpan.org/~tty/kurila-0_02/
Hmm: http://search.cpan.org/src/TTY/kurila-0_02/
It looks like this person, TTY, uploaded a modified version of Perl to
his/
http://search.cpan.org/search?m=module&q=getopt&s=21
--
Jorge Almeida
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Chas Owens wrote:
> On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>> On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>> snip
>> > my $tidy = "/usr/bin/tidy";
>> > my @tidy_args = qw(--foo --bar -- example);
>> > my $path = get_path();
>> > my $file = $path . get_file();
>> >
>> > system($tidy,
Okay, I eliminated the tidy with some more robust regex. D'oh!
Case closed!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote:
snip
> my $tidy = "/usr/bin/tidy";
> my @tidy_args = qw(--foo --bar -- example);
> my $path = get_path();
> my $file = $path . get_file();
>
> system($tidy, @tidy_args, $file);
Opps, forgot the erro
On 6/3/07, Chas Owens <[EMAIL PROTECTED]> wrote:
snip
my $tidy = "/usr/bin/tidy";
my @tidy_args = qw(--foo --bar -- example);
my $path = get_path();
my $file = $path . get_file();
system($tidy, @tidy_args, $file);
Opps, forgot the error checking.
system($tidy, @tidy_args, $file)
or die qq(
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote:
snip
Then I attempted to use Tidy, sans HTML::Tidy, through Shell. The
HTML::Tidy lib won't work on my system. So, I have been futzing with
tidy and I'v e discovered that tidy and simple commands like cd fail,
most likely because of the spaces in
On Jun 3, 2007, at 1:59 PM, Chas Owens wrote:
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote:
snip
I have to assume that paths can be converted easily for use in shells
and such, without resorting to RegEx. Any ideas?
snip
Aside from the multi argument version of system that Tom has alread
Begin forwarded message:
From: Mike Lesser <[EMAIL PROTECTED]>
Date: June 3, 2007 3:48:56 PM EDT
To: "Chas Owens" <[EMAIL PROTECTED]>
Subject: Re: Paths, Spaces, Getopt::Long
On Jun 3, 2007, at 1:59 PM, Chas Owens wrote:
On 6/3/07, Mike Lesser <[EMAIL PROTECTED
Well I'm not sure. I may be explaining this badly. I'll go thru all
the details in case it helps.
The path I pass when I'm executing the script is escaped, which I
assume is correct.
Once that path is read by Getopt, I print it and, voila, no escapes,
just nice-to-read
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote:
snip
I have to assume that paths can be converted easily for use in shells
and such, without resorting to RegEx. Any ideas?
snip
Aside from the multi argument version of system that Tom has already
mentioned, the bigger question is "Why are you
On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote:
I use the module Getopt::Long to read arguments, one of which is a
file path that may have spaces. The path string that is returned from
Getopt has spaces without escape chars. The string seems to be fine
for Perl use, but not so gre
Hi all. I have a problem that _must_ have a very simple solution
(that I can't find).
I use the module Getopt::Long to read arguments, one of which is a
file path that may have spaces. The path string that is returned from
Getopt has spaces without escape chars. The string seems
On Wed, Jan 24, 2007 at 06:53:53AM -0800, Tom Phoenix wrote:
>
> Why not simply move things to the trashcan, and skip rm altogether?
Yeah . . . I'd probably solve this problem by using the mv command. If
you really wanted to, you could just write a shell or Perl script called
"trash" that moved
On 1/23/07, Tony Heal <[EMAIL PROTECTED]> wrote:
The end process will be myscript.pl -rf /home/myfolder and that will pass
the -rf and /home/myfolder arguments to the rm command after copying
everything to the trashcan.
Why not simply move things to the trashcan, and skip rm altogether?
The
I found an example using getopt on the web and I am trying to convert it to
my use. Everything works except the last part. What am attempting to do is
create a script which I can pass switches as arguments. Eventually this
script will replace the rm command on my linux server, so that I can
> Getopt::Std only works with single hyphen switches, the only
> exceptions being '--', '--help' and '--version'.
>
> perldoc Getopt::Std
>
>
> Getopt::Std also processes swithes in clusters so "-abcd
> filename" is th
RICHARD FERNANDEZ wrote:
> Hi Folks,
Hello,
> I've written a little mytest.pl using Getopt::Std:
>
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> use Getopt::Std;
>
> getopt('hl');
> our ($opt_h, $opt_l);
>
> my $hostname = $opt_h
Hi Folks,
I've written a little mytest.pl using Getopt::Std:
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Std;
getopt('hl');
our ($opt_h, $opt_l);
my $hostname = $opt_h ? $opt_h : undef;
my $file = $opt_l ? $opt_l : undef;
my @volgroups = @ARGV;
).
Try this
use Getopt::Std;
use strict;
our ($opt_a, $opt_b, $opt_c);
getopts( 'a:b:c:' );
print join "\n", ($opt_a, $opt_b, $opt_c);
HtH
WayPay
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/&
hi All,
I have to call some perl scripts with command line arguements from another
perl script.
(some thing like this)
perl -s -a $ENV{X} -b $ENV{Y} -c $ENV{Z} ; ( -a , -b, -c are also the
arguments to call the script)
( the $ENV{x}=C:\xyz\abc,$ENV{Y}=abc,$ENV{Z}=5).
I understand we
Sheng Bao wrote:
>
hi guys,
I encountered a problem when install GetOpt::Tabular.
At the first step, I stopped. Here is the error output.
[EMAIL PROTECTED] Getopt-Tabular-0.3]# perl ./Makefile.PL
Config.pm did not return a true value at
/usr/lib/perl5/5.8.6/ExtUtils/MakeMaker.pm lin
hi guys,
I encountered a problem when install GetOpt::Tabular.
At the first step, I stopped. Here is the error output.
[EMAIL PROTECTED] Getopt-Tabular-0.3]# perl ./Makefile.PL
Config.pm did not return a true value at
/usr/lib/perl5/5.8.6/ExtUtils/MakeMaker.pm line 9.
BEGIN failed
Chris Knipe wrote:
Hi all,
Just a quick question and a couple of lines of really simple code
use Getopt::Long;
...
GetOptions ('h' => \$h,
'b=s' => \$s );
Sub ShowHelp() {
That should be
sub ShowHelp {
Perl isn't VB :)
Chris Knipe wrote:
So, this is more of a block question I think, but how I can get the above
example to show the help screen FIRST, and THEN complain about the missing
value for -s
Why?
Here's an example of how to do it:
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
use
als sign indicates that this
option
requires a value. The letter "s" indicates that this value is an
arbitrary string. Other possible value types are "i" for integer
values..."
-Original Message-
From: Chris Knipe [mailto:[EMAIL PROTECTED]
Sent: Monda
Hi all,
Just a quick question and a couple of lines of really simple code
use Getopt::Long;
...
GetOptions ('h' => \$h,
'b=s' => \$s );
Sub ShowHelp() {
print "this is help"
}
Sub DoSomethingWithString() {
...
}
If ($s)
riya wrote:
Shouldn't following snippet throw error message when
it is called without any parameter?
I can't see any error messsage, why?
Because this didn't have an error.
If you want it to quit, force it to quit.
#!/usr/bin/perl
use Getopt::Long;
GetOption
[PLEASE don't top-post; it makes it hard to follow the conversation]
On Sep 9, Manish Sapariya said:
On 09/09/2005 05:56 PM, Chris Devers wrote:
On Fri, 9 Sep 2005, Manish Sapariya wrote:
Shouldn't following snippet throw error message when
it is called without any parameter?
Because this
Shouldn't following snippet throw error message when
it is called without any parameter?
I can't see any error messsage, why?
Because this didn't have an error.
If you want it to quit, force it to quit.
#!/usr/bin/perl
use Getopt::Long;
GetOption
On Fri, 9 Sep 2005, Manish Sapariya wrote:
> Shouldn't following snippet throw error message when
> it is called without any parameter?
>
> I can't see any error messsage, why?
Because this didn't have an error.
If you want it to quit, force it to quit.
#!/us
Shouldn't following snippet throw error message when
it is called without any parameter?
I can't see any error messsage, why?
# /tmp/test.pl
Executed successfully
#
--
#!/usr/bin/perl
use Getopt::Long;
GetOptions("verbose" => \$ve
On 4/23/05, Carlos Mantero wrote:
> Hi everybody! I'm very newbie programmer of Perl and I can't make a
> little program with a small number of arguments with this Perl module,
> Getopt::Mixed. I like that somebody will can make a simple program
> exemple with some ar
Hi everybody! I'm very newbie programmer of Perl and I can't make a
little program with a small number of arguments with this Perl module,
Getopt::Mixed. I like that somebody will can make a simple program
exemple with some argument. Thanks for all.
Regards,
Carlos Mantero.
--
To u
ing "use strict" and "use warnings" which alway gives good
hints :-),
and it works - but maybe in the sense you mentioned that it works for you too:
=== begin script (test3.pl) ===
use strict; use warnings;
use Getopt::Long;
sub notify_email {
local @ARGV = @_;
my (@recipien
tify_email {
local @ARGV = @_; # Get the sub's params into the master param array for
GetOpt::Long
$ENV{"NTsendmail"} = $conf{'smtp'};
$sender = $conf{'smtpsender'};
GetOptions ("r=s" => [EMAIL PROTECTED], # -r [EMAIL PROT
Olivier, Wim W wrote:
> Hi Bob,
Hi. Don't top-post please.
> If
> I comment out this if statement, I don't get the error anymore. An
> clues as
> to the correct syntax???
>
> I run the subroutine as follows:
>
> if ($conf{'pnl_check_for_analytics_email'} =~ 'ON')
>{ notify_email -r [EMAI
Hi Bob,
(Offer Kaye, thanks for the reply as well!)
I used the method below (local @ARGV = @_;) to get the values of @_ into
@ARGV for the use of Getopt::Long. It appears to be working fine like that.
I now have another problem with, it appears, syntax. The IF statement is
part of a block in
On 4/20/05, Olivier, Wim W wrote:
> Hi all,
>
> Is it possible to use GetOpt::Long (or something similar) in a subroutine
Getargs::Long -
http://search.cpan.org/dist/Getargs-Long/
HTH,
--
Offer Kaye
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mai
Olivier, Wim W wrote:
> Hi all,
>
> Is it possible to use GetOpt::Long (or something similar) in a
> subroutine
> using @_ instead of in the standard way (using @ARGV)?
This should work:
sub foo {
local @ARGV = @_;
GetOptions(...blah...);
...
}
--
To
How about something like this? It doesn't make it like GetOpt::Long,
but it does handle what you want. Or you could just require that people
pass an array to your subroutine and save yourself a little work. If
there is only one recipient, then it's a one-ele
Hi all,
Is it possible to use GetOpt::Long (or something similar) in a subroutine
using @_ instead of in the standard way (using @ARGV)?
I want to have the following scenario, but use GetOpt in a subrouting within
the main script and pass options (and values) to the subroutine.
The values
At 10:46 AM 3/25/2005 -0600, Shiping Wang wrote:
Hi, I have problem to match array defined in Getopt::Long and transfer to
new file:
If I do:
try.pl --InputData sample.txt --Trait=_BMI --covars=age, _DBP, _SBP
--Race=Others
with this file:
GFAMID GDADID GMOMID ID SEX
HYT3 _SBP _DBP _BMI
Hi, I have problem to match array defined in Getopt::Long and transfer to
new file:
If I do:
try.pl --InputData sample.txt --Trait=_BMI --covars=age, _DBP, _SBP
--Race=Others
with this file:
GFAMID GDADID GMOMID ID SEX
HYT3 _SBP _DBP _BMI RACE AGE _HTMED antiht
How can I get it to
Mike Donnelly wrote:
Using the example code below, I find that I can
use getopt handily to pass all sorts of
variables to my script, as long as a
value passed is not a 0 (zero)
How to I use getopt::long and be able to
pass the number zero as a value?
Code, and behavior follows
Using the example code below, I find that I can
use getopt handily to pass all sorts of
variables to my script, as long as a
value passed is not a 0 (zero)
How to I use getopt::long and be able to
pass the number zero as a value?
Code, and behavior follows
--- [EMAIL PROTECTED] wrote:
>
>
> - Original Message -
> From: Mike Donnelly <[EMAIL PROTECTED]>
> Date: Tuesday, December 21, 2004 10:58 am
> Subject: Getopt::Long , handles the number zero
> differently..
>
> Hello
> >
> >
> &
- Original Message -
From: Mike Donnelly <[EMAIL PROTECTED]>
Date: Tuesday, December 21, 2004 10:58 am
Subject: Getopt::Long , handles the number zero differently..
Hello
>
>
> Using the example code below, I find that I can
Please paste working code....
> use
Using the example code below, I find that I can
use getopt handily to pass all sorts of
variables to my script, as long as a
value passed is not a 0 (zero)
How to I use getopt::long and be able to
pass the number zero as a value?
Code, and behavior follows
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Christian Stalp) writes:
>What can I do to use getopt() and use strict?
>If I use strict I have to declare all of my variables. And if I do this, perl
>ignores my getopt(s) single-chars. Is this normal? What can I do to solve
> Declare your variables with our() if you're using Perl 5.6 or better;
> otherwise, declare them with 'use vars'.
All right, it works now, thank you very much.
> If you're using Perl 5.6, don't use "-w" anymore, use the "warnings"
> pragma.
warnings? How does this works?
#!/usr/bin/perl warnin
On Oct 15, Christian Stalp said:
>What can I do to use getopt() and use strict?
Declare your variables with our() if you're using Perl 5.6 or better;
otherwise, declare them with 'use vars'.
>If I use strict I have to declare all of my variables. And if I do this, perl
Hello together, I have a new problem.
What can I do to use getopt() and use strict?
If I use strict I have to declare all of my variables. And if I do this, perl
ignores my getopt(s) single-chars. Is this normal? What can I do to solve
this?
I want to use perl with "-w" opti
On Tue, 28 Sep 2004, Wiggins d Anconia wrote:
> On Tue, 28 Sep 2004, Chris Devers wrote:
>
> > On Tue, 28 Sep 2004, Errin Larsen wrote:
> >
> > > On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya
> > > <[EMAIL PROTECTED]> wrote:
> > >
> > > > use vars qw($f);
> > >
> > > The above is good, b
> On Tue, 28 Sep 2004, Errin Larsen wrote:
>
> > On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya
> > <[EMAIL PROTECTED]> wrote:
> >
> > > use vars qw($f);
> >
> > The above is good, but is now obsolete.
>
> That is debatable.
>
Please, beginners, recognize the above word, *debatable*!! I
Errin Larsen wrote:
> So, what was the justification for changing 'use vars' to 'our'?
I don't know, but I suspect it's because "our" is a complement to "my". Same
syntax (no silly qw() business), same lexical scoping, etc.
You're correct. our() should be used and 'use vars' should be considered
Edward Wijaya wrote:
> Hi,
Hello,
> Why my code below fail to open and
> print the file contents
>
> when I do:
>
> perl mycode.pl -f filename
>
>
> __BEGIN__
> use strict;
> use warnings;
>
> use Getopt::Std;
> use vars qw($f);
> getopts('
out this issue? (I did read the link you supplied,
but it didn't go into WHY this changed.)
The advice I was giving in this thread was based on the following
quote in my 'perldoc Getopt::Std' documentation. (A quote from that):
Note that, if your code is running under
On Tue, 28 Sep 2004, Errin Larsen wrote:
> On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya
> <[EMAIL PROTECTED]> wrote:
>
> > use vars qw($f);
>
> The above is good, but is now obsolete.
That is debatable.
Gather round, and listen to the story of a log handling utility
written in
earnt much from it.
>
> >
> > Edward, I could write this script two ways. The first is the way I
> > prefer and it doesn't use 'Getopt::Std' at all:
> >
> I need to use Getopt, as I will increase
> the number of user given options.
>
> Regards
> Edwar
> __BEGIN__
> use strict;
> use warnings;
Good Start! Those pragmas above are very helpful!
>
> use Getopt::Std;
> use vars qw($f);
The above is good, but is now obsolete. The preferred method is to
use 'our' declarations
Also, the 'getopts()' functio
1 - 100 of 223 matches
Mail list logo