Re: strict getopt()
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 this? Learn about references; there is another argument allowed for the getopts() function. Try this: use Getopt::Std; my %opt; getopts('abcde', \%opt); Now run that with some options and inspect the hash %opt after the getopts() call. I want to use perl with -w option and the strict pracma. Is this posible? Not only possible, I consider it mandatory :-) -- Peter Scott http://www.perldebugged.com/ *** NEW *** http://www.perlmedic.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
strict getopt()
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 option and the strict pracma. Is this posible? Gruss Christian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: strict getopt()
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 ignores my getopt(s) single-chars. Is this normal? What can I do to solve this? I want to use perl with -w option and the strict pracma. Is this posible? If you're using Perl 5.6, don't use -w anymore, use the warnings pragma. -- Jeff japhy Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.perlmonk.org/ % have long ago been overpaid? http://www.perlmonks.org/ %-- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: strict getopt()
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 warnings or use warnings; ? I just tested it, and both were accepted. Gruss Christian -- Christian Stalp Institut für Medizinische Biometrie, Epidemiologie und Informatik (IMBEI) Obere Zahlbacher Straße 69 55131 Mainz Tel.: 06131/ 17-6852 E-Mail: [EMAIL PROTECTED] Internet: www.imbei.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response