![]() |
|< 1 2 >| | ![]() |
20 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use vars qw($opt_d $opt_x $opt_h);
use Getopt::Std;
#
&getopts("a::d::h")||die "ERROR: No such option. -h for help\n";
&help if ($opt_h);
if ($opt_a){
printf("not implemented.");
}elsif ($opt_d){
$base = shift(@ARGV);
$base2= shift(@ARGV);
print $base;
print $base2;
etc.
_______________________________________________
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
GetOptions('-d' => \my $d_schalter);
my @files = @ARGV;
print $_,"\n" for @files;
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
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use vars qw($opt_d $opt_a $opt_h);
#
GetOptions("-a" => \$opt_a,
"-d" => \$opt_d,
"-h" => \$opt_h,);
help() if ($opt_h);
if ($opt_a){
print "not implemented.";
}
elsif ($opt_d){
my $base = shift(@ARGV);
my $base2= shift(@ARGV);
print $base;
print $base2;
}
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
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use vars qw($opt_d $opt_a $opt_h $argument);
#
GetOptions("-a" => \$opt_a,
"-d" => \$opt_d,
"-s=s" => \$argument,
"-h" => \$opt_h,);
help() if ($opt_h);
if ($opt_a){
print "not implemented.";
}
elsif ($opt_d){
my $base = shift(@ARGV);
my $base2= shift(@ARGV);
print $base;
print $base2;
}
if(defined $argument){
print $argument;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my (@files,$opt_a,$opt_h);
#
GetOptions("-a" => \$opt_a,
"-d" => \@files,
"-h" => \$opt_h,);
help() if ($opt_h);
if ($opt_a){
print "not implemented.";
}
elsif ($opt_d){
print $_,"\n" for(@files);
}
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
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my (@files,$opt_a,$opt_h);
#
GetOptions("-a" => \$opt_a,
"-d" => \@files,
"-h" => \$opt_h,);
help() if ($opt_h);
if ($opt_a){
print "not implemented.";
}
if (@files){
print $_,"\n" for(@files);
die "Nicht genügend Dateien" if(scalar(@files) < 2);
}
sub help{
print "help";
exit;
}
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
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my ($opt_a, $opt_d);
# Optionen auswerten
GetOptions(
a => sub { die "noch nicht implementiert" },
d => \$opt_d,
'h|help' => \&help,
) or help();
# Restliche Argumente in @files
my @files = @ARGV;
# Wenn $opt_d, dann müssen zwei Argumente da sein!
die "zu wenig Argumente" if $opt_d && scalar @files < 2;
# und so weiter
sub help {
print <<EOT;
Usage: ...
EOT
exit -1;
}
![]() |
|< 1 2 >| | ![]() |
20 Einträge, 2 Seiten |