Professional Web Applications Themes

strict & getopt() - PERL Beginners

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...

  1. #1

    Default 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
    Christian Guest

  2. #2

    Default Re: strict & getopt()

    On Oct 15, Christian Stalp said:
     

    Declare your variables with our() if you're using Perl 5.6 or better;
    otherwise, declare them with 'use vars'.
     

    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

    Jeff Guest

  3. #3

    Default Re: strict & getopt()

    > Declare your variables with our() if you're using Perl 5.6 or better; 

    All right, it works now, thank you very much.
     

    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: uni-mainz.de
    Internet: www.imbei.de
    Christian Guest

Similar Threads

  1. Getopt::Std question
    By sstark in forum PERL Modules
    Replies: 2
    Last Post: September 8th, 04:32 PM
  2. getopt
    By Spartan815 in forum UNIX Programming
    Replies: 4
    Last Post: January 26th, 01:24 AM
  3. Using Getopt::Std
    By Perl in forum PERL Beginners
    Replies: 3
    Last Post: January 13th, 08:21 PM
  4. Getopt module
    By John W. Krahn in forum PERL Beginners
    Replies: 1
    Last Post: September 7th, 09:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139