On Fri, 19 Jul 2002, Sudarshan Raghavan wrote: > On Fri, 19 Jul 2002, Angerstein wrote: > > > Hello, > > I have a very unfunny problem, on which i am working for hours. > > > > I need to find out if a string contains an other specified string. > > I want to use pattern-matching. > > I canīt get a match together which make this. Look at my examples, > > none of the Matchings using vars works. If I replaces the vars to normal > > strings it works like it should. > > I am using perl 5.6 on a aix 4.3.3. > > > > Thanks for help! > > ############################################ cut > > ################################################# > > #!/usr/bin/perl -w > > > > my $hund= "hund m-a-u-s katze k.a.t.z.e. maus xyz 1234"; > > my $dings1 = "hund"; > > my $dings2 = "m-a-u-s"; > > my $dings3 = "k.a.t.z.e."; > > my $dings4 = "xyz"; > > my $dings5 = "123"; > > > > if ( $dings1 =~ /\Q$hund/) { > > print "$dings1 in \$hund";} > > You are searching for $dings1 in $hund, this must be the other way around > if ($hund =~ /\Q$hund/)
sorry, this should be if ($hund =~ /\Q$dings1/) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]