my @array; while ( my $line = ) { if ( $line =~ /\(.*)\<\/TAG\>/ ) { push @array, $1; } }