Why is this not a match?

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default Why is this not a match?

    Hello All,

    I am unable to find out why is this not matching:

    I do have a file where the second line contains:

    Summary Log (generated: Tue Apr 1 22:02:29 MST 2003)

    I am processing this file by this script:

    #!usr/bin/perl -w

    use strict;
    use Fcntl qw[:flock];

    my $impressions = 0;
    my $iofile = '/other/scripts/daniel/input/c07_impressions_io.info';

    open (IO, $iofile) || die("Could not open file 1!");

    while (<IO> ) {
    chop;
    (my$FH, my$output, my$file2check, my$month, my$year) = split
    (/\s+/, $_);

    open OUT, ">> $output";

    chdir $FH or die "$!";

    while (glob $file2check) {
    print "Processing $file2check";
    open FH, $_ or die $!;
    flock FH, LOCK_SH or die $!;
    while (<FH> ) {
    chomp;
    if ( / Summary Log (generated:/ ) {
    my($summary, $log, $generated, $day_word, $m,
    $day_number,$time,$timezone, $year ) = split(/\s+/, $_);
    # $impressions += $value if ($value =~ /\d+/);
    print "File $file2check is $month, $year\n";

    }
    }
    close FH or die $!;
    }
    }
    # print OUT 'Total impressions: ', $impressions or die $!;
    print $output, $file2check, $month, $year

    Where I am checking if there is a line Summary log by "if ( / Summary
    Log (generated:/ ) {"

    And I am receiving this error:

    Unmatched ( in regex; marked by <-- HERE in m/ Summary Log ( <-- HERE
    genereated:/ at c07_imp.pl line 25.

    Does anybody know why?

    Thank you for your time.

    danield

    Danield Guest

  2. Similar Questions and Discussions

    1. Get todays match...
      "SELECT matchdate,hometeam,awayteam,homescore,awayscore FROM MatchData ORDER BY matchdate ASC" Above the string i use to get information about...
    2. pattern match
      Where can I find infi or doc on "pattern match" used within WHERE clause (mysql). As I need to matche with PHP variables I'd prfer something...
    3. How do I RegExp Match a ? without using \X{3F}?
      Is there a way to match a question mark using a regular expression without looking for a \X{3F} ? Thanks in advance, -Dan
    4. please help !! pattern match
      Hi , I need some help me to extract a pattern. The delimiters is a pair of "abcd" and "efgh". Can some one help me with an efficient use of Greedy...
    5. Match min and max chars
      I want to set a minimum and maximum number of characters to a field. I can't seem to get any value to get the maximum to check. On the perlretut I...
  3. #2

    Default RE: Why is this not a match?

    danield <sun_x86@telus.net> wrote:
    :
    : I am unable to find out why is this not matching:
    :
    :[snip]
    :
    : if ( / Summary Log (generated:/ ) {


    The open parenthesis '(' has to be escaped.

    if ( / Summary Log \(generated:/ ) {


    HTH,

    Charles K. Clarkson
    --
    Head Bottle Washer,
    Clarkson Energy Homes, Inc.
    Mobile Home Specialists
    254 968-8328

    Charles K. Clarkson Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139