foreach $l(@lines) {#traversing the file if($line=~ /
<\/div>\n(.*?)/) { $kb_layout_id=$&; print "$kb_layout_id\n"; } }