open (INF, "$file"); while (){ if(/First line of text[\n]second line of text[\n]in the third line I have (\d*\.\d*)/) { push(@array,$1); } }