@lines is an array which contains blank lines as well as textlines...what i want to do is to get a line from array thru shift(@lines) until the array doesnt contain the textline or array has no more line(element)..how i should implement the red part while( ($details_1 = shift(@lines) ) =~ /^$/ ) { }; Thanks in advance, Rahul