use strict; use warnings; open (F1, "new5.txt") or die; while () { open (F3, "; print F2 if (/$lines/); close (F3); } close (F1); close (F2);