can't get backreferences to work

Discussion in 'Perl' started by everymn@yahoo.com, Feb 20, 2007.

  1. Guest

    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:
    , Feb 20, 2007
    #1
    1. Advertising

  2. Guest

    figured it out, thanks
    , Feb 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Fletcher
    Replies:
    1
    Views:
    477
    Mark Fletcher
    May 19, 2004
  2. Chris Nolte
    Replies:
    9
    Views:
    4,259
    Jeff Schwab
    May 25, 2004
  3. dhek bhun kho

    java.util.regex: Backreferences?

    dhek bhun kho, Jul 9, 2003, in forum: Java
    Replies:
    2
    Views:
    774
    dhek bhun kho
    Jul 9, 2003
  4. Amy Dillavou

    backreferences

    Amy Dillavou, Sep 28, 2005, in forum: Python
    Replies:
    4
    Views:
    427
    Peter
    Sep 28, 2005
  5. Wolfgang Thomas
    Replies:
    16
    Views:
    198
    Xicheng
    Mar 9, 2006
Loading...

Share This Page