in reply to Regular Expression memory

What exactly isn't working?

my $str = '<Id>3456</Id>' ; $str =~ m#(<Id>)(.*)(</Id>)# ; print "1 - $1\n2 - $2\n3 - $3\n" ; [ doug 14:49 ~ ]% perl test.pl 1 - <Id> 2 - 3456 3 - </Id>

BTW, if you're trying to parse XML, take a look at XML::Simple; it does a fine job.


_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

Replies are listed 'Best First'.
Re: Re: Regular Expression memory
by Anonymous Monk on Nov 22, 2002 at 01:18 UTC
    Thanks all replies. I figure out the problem - it's because the memory variables - $1,$2, still retains it's old value in next loop (while(<>) ) and doesn't show the correct "values"! Thanks again.