![]() |
![]() |
10 Einträge, 1 Seite |
$perl /home/user/foo -s
$perl /home/user/foo -l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl -w
use strict;
my $file = 'test.txt';
my $arg = pop(@ARGV);
if ($arg eq '-s') {
print "Verschiebe Datei\n";
#...
} elsif ($arg eq '-l') {
print "Lösche Datei\n";
#...
} else {
print "Unbekanntes Argument\n";
}
$arg=~ qw/-s/
$arg=~ /\-s/
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/perl use strict; use warnings; use Getopt::Long; GetOptions( '-s' => \my $delete ); if( $delete ){ print "lösche Datei\n"; }
Quotemap { $opts{$_} = 1 if ( $_ =~ m(^-) ) } @ARGV;
if ( defined($opts{-s}) ) {
doSomething();
}
Quotemap { $opts{$_} = 1 if ( $_ =~ m(^-) ) } @ARGV;
if ( defined($opts{-s}) ) {
doSomething();
}
![]() |
![]() |
10 Einträge, 1 Seite |