Thread Name /.*::.*/ used only once: possible typo at (18 answers)
Opened by Knuddlbaer at 2004-04-18 02:04

Knuddlbaer
 2004-04-18 04:38
#81643 #81643
User since
2004-04-13
32 Artikel
BenutzerIn
[default_avatar]
Code: (dl )
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
package param;
%options;
@parameter;
$help;

my @zeichen;
   foreach(@ARGV)
   {
       if($_ =~ /^--(.*)(:?=(.*))?/)
       {   if($2)
           { $param::options{"$_"} = $2; }
           else
           { $param::options{"$_"} = 1; }
       }
       elsif($_ =~ /^-(.*)/)
       {
           @zeichen = split ( // , $1);
           foreach(@zeichen)
           {
               $param::options{"$_"} = 1;
           }
       }
       else
       {
               push(@param::parameter,$_);
       }
   }
   $help =  ($param::options{"help"} || $param::options{"h"});

1;



Vorgestellt hab ich mir das so:

Ich binde param ein , das soll die Parameter parsen und in den Vairablen %param::options und $param::parameter zur verfügung stellen. Ich brauche genau den Code in rund 20 Perlprogrämmchen und wollte den nich jedesmal reinkopieren etc.

Aber das klappt so nicht :o(\n\n

<!--EDIT|Knuddlbaer|1082249035-->

View full thread Name /.*::.*/ used only once: possible typo at