in reply to how to empty the built_in variable

my $line; while ( <DATA> ) { chomp; $line = $_; $line =~ /\s+<\w+\/?>(.*)<\/\w+>/; $line = $1; print "$line\n"; }

In addition to the other comments you got, you should as usual declare your lexical variables in the innermost scope as possible; in this case:

while ( <DATA> ) { chomp; my $line = $_; # ...

But... all in all it's strange that you use the implicit $_ only to assign it to $line. You either want

while ( <DATA> ) { chomp; /\s+<\w+\/?>(.*)<\/\w+>/ or next; print $1, "\n"; }

or

while ( my $line=<DATA> ) { chomp $line; $line =~ /\s+<\w+\/?>(.*)<\/\w+>/ or next; print $1, "\n"; }