very new - need help with regular expressions

From: Brett Williams (brettaw_at_gmail.com)
Date: 03/26/05


Date: Sat, 26 Mar 2005 19:33:50 +1100
To: beginners@perl.org

Hi :)

I am still very new to perl (and programming) and am getting stuck with
regular expressions. I have a text file in which I want to find, then
print to screen all lines beginning with "?" and then print the text
between the "<" and ">" characters. The code I have tried (amongst many
variations) is below

(open(INPUT, "record.txt")) || die("Error, can't find file\n");
$line = readline(INPUT);
while($line =~ /^\?/)
{
chomp($line);
print($line =~ /(.+)<\/a>\]/);
$line = readline(INPUT);
}
close(INPUT);

record.txt contains

___

#Retail price items

?<1002.00>
?<125.00>
?<61864.35>
?<890876.99>
?<9.99>

#Transaction code

S,M,L

#Sales commission

5:7:10

___

This code returns nothing. I am at a loss as to what im doing wrong &
have been playing with this since yesterday. Big thanks to anyone who
can help :)

brettaw