in reply to Re^2: Help regarding regular expression
in thread Help regarding regular expression

You open IN for writing, and later try to read from it - that won't work. Also reading from a file is done with <IN> (note the angle brackets).

You also match against @line1 which you never initialized.