Connecting Tech Pros Worldwide Help | Site Map

can't get backreferences to work

  #1  
Old February 20th, 2007, 11:25 PM
everymn@yahoo.com
Guest
 
Posts: n/a
Could someone tell me what I'm doing wrong to cause the backreference
variable to fail to be assigned here? It's entering the If block 4
times, so I know it's matching but there's nothing in $1?

Thank You!


#! /usr/bin/perl
use warnings;
use strict;

open FH, 'results.xml' or die "this didn't work: $!";

$/ = "<test-case name=";

while (<FH>)
{
if (/rssupports/)
{
print "DEBUG: \n";
print "$1" if defined $1;
}
}

OUTPUT:
DEBUG:
DEBUG:
DEBUG:
DEBUG:
  #2  
Old February 21st, 2007, 12:35 AM
everymn@yahoo.com
Guest
 
Posts: n/a

re: can't get backreferences to work


figured it out, thanks
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the "longest possible" match with Python's RE module? Licheng Fang answers 32 September 16th, 2006 11:55 PM
Seeking regex optimizer Kay Schluehr answers 15 June 20th, 2006 04:15 PM
Using backreferences within a pattern using eregi_replace Martin Lucas-Smith answers 1 December 20th, 2005 07:45 PM