open(TXTIN,"input") || die "Cannot open the data file"; open(TXTOUT,">output") || die "Cannot open the formatted file"; while(){ if (/^[1-9]/){ s/^[1-9].//; print TXTOUT; } else{ @array=$_;#???this is where I am lost print TXTOUT @array;} } close (TXTIN); close (TXTOUT);