title: Perl RegEx error
body: <p>I am currently trying to create a log parser that takes from an input file (a .log) a series of ping reports in the following format: (64 bytes from 194.12.224.34: icmp_seq=1 ttl=47 time=66.7 ms) and builds an output file (a .csv).</p>
  
  <p>After numerous attempts, I hit the below error. My workmate gave me his code (below), which is written differently but is in essence the same. His code gives the same error, although his, naturally, works just fine at the same task. Any assistance would be much appreciated!</p>
  
  <p>I now believe my first two regex's work ok, the third is the problem.  Below is what I am attempting to parse:</p>
  
  <p>120 packets transmitted, 120 received, 0% packet loss, time 119247ms
  rtt min/avg/max/mdev = 65.944/67.381/72.714/1.728 ms</p>
  
  <p>My first post on here, apologies if something is missing.</p>
  
  <pre><code>$INPUT  = "ping.log";
  $OUTPUT = "pingParsed.csv";
  
  # &gt; operator puts the write function in overwrite mode rather than append.
  open (INPUT, '&lt;', $INPUT);
  open (OUTPUT, '&gt;', $OUTPUT);
  
  while (&lt;INPUT&gt;) {
  
  # if (timestamp regex)
  if(/(\w{3})\s+(\w{3})\s+(\d+)\s+(\d+):(\d+):(\d+)\s+GMT\s+(\2013)/) {
  
  
  # print OUTPUT (date regex variables, $1 = Day, $2 = Month, $3 = Day, $4 = hour, $7 = year)
  print OUTPUT "$1 , $2 , $3 , $4 , $7";
  
  $headers = "IP, Seq, Time";
  
  print OUTPUT "$headers";
  
  }
  
  # if (ping info regex, $1 = IP address, $2 = Seq, $3 = Time)
  if ( m/icmp_seq=
  (\S+)
  \s+ttl=
  (\S+)
  \s+time=
  (\S+) /x) # x allows use of whitespaces and comments in the regex.
  {
      print "$1, $2, $3\n";
  }
  
  
  # if (regex for total ping info - I think this is line 55.) 
  if (/\d+\d+\d+\s+\packets\s+\transmitted,\s+\d+\d+\d+\s+\received,\s+(\d+)\s+\packet\s+\loss,\s+time\s+(\d+)\ms\s+\min\avg\max\mdev\s+=\s+(\(S+)\\/\(S+)\\/(S+)\\/\(\S+)\s+\ms/) {
  headers: 
  print ("$15 = packet loss(%), $22 = time(ms), $28 = rttmin, $33 = arg, $35 = max, $37 = ndev");
  
  print OUTPUT ($15, $22, $28, $33, $35, $37);
  
   } 
  
  
  }
  
  close $INPUT;
  close $OUTPUT;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Backslash found where operator expected at ./pingParseScript.pl line 55, near "/\d+\d+\d+\s+\packets\s+\transmitted
      (Missing operator before \?)
  </code></pre>
  
  <p>Backslash found where operator expected at ./pingParseScript.pl line 55, near ")\"
          (Missing operator before \?)
  Backslash found where operator expected at ./pingParseScript.pl line 55, near ")\"
          (Missing operator before \?)
  syntax error at ./pingParseScript.pl line 55, near "/\d+\d+\d+\s+\packets\s+\transmitted,\s+\d+\d+\d+\s+\received,\
  Substitution pattern not terminated at ./pingParseScript.pl line 55.</p>