Leser: 1
8 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
my $muster ="1-5-4-bla2-sles8";
my @array =("i486-glibc22-linux","sles8");
foreach(@array)
{
my $element = $_;
if(grep (/$element/,$muster ))
{
print "$element gefunden in $muster\n";
last;
}
else {
print " nicht gefunden \n";
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
my @array =("i486-glibc22-linux", "sles8");
foreach(@array)
{
if(/^(1|5|4|bla2|sles8)$/)
{
print "$_ gefunden in (1|5|4||bla2|sles8)\n";
last;
}
else {
print " nicht gefunden \n";
}
}
if(grep /$_/, $muster)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
my $muster ="1-5-4-bla2-sles8";
my @array =("i486-glibc22-linux","sles8");
foreach my $element(@array) {
if($muster =~ /$element/) {
# oder
# if(index($muster,$element) != -1){
print "$element gefunden in $muster\n";
last;
}
else {
print " nicht gefunden \n";
}
}
if(grep /$_/, $muster)
1
2
3
4
5
6
my $muster = '1-5-4-bla2-sles8';
my @elements = qw/i486-glibc22-linux sles8 0815 5-4 foo/;
my @found = grep { $muster =~ /$_/ } @elements;
print 'Die Elemente ' . join(', ',@found);
print " wurden in dem Muster $muster gefunden.\n"
$element = quotemeta($_)
$muster =~ /\Q$_\E/
index($muster, $_) >= 0
8 Einträge, 1 Seite |