in reply to Generalising string in pattern

See perlre. If you show us the code you've written, we can give you more concrete comments about it.

Replies are listed 'Best First'.
Re^2: Generalising string in pattern
by rajyalakshmi (Acolyte) on Nov 13, 2009 at 08:41 UTC

    #!/usr/bin/perl

    $filepath="D:/fetch/autofetch.log";

    my $pattern1 =' Latest 29 Items in Feed & 0 New Fetched items';

    sysopen($FILE,$filepath,o_RDWR) or die "could find the file";

    while (my $line = <$FILE>) { # print $line if ($line =~m/\b$pattern1/ ); if($line =~m/$pattern/ ) { print $line; }

    In the file i am searching for $pattern1.

    The file has

    Latest 29 Items in Feed & 0 New Fetched items

    Latest 28 Items in Feed & 0 New Fetched items

    Latest 28 Items in Feed & 0 New Fetched items

    Now i want pattern to match all 3..

    But now my present pattern matches only first one

      See perlre about \d, or about the [...] character class notation.

      Also, you might want to use <code>...</code> tags around your code and data so it renders and downloads nicely.