while (<>) { # process list of files open (OUT, ">TEST"); chomp; /^Sen = (\S+).*/; /^Acc = (\S+).*/; /^Cor = (\S+).*/; push @array, "$1", "$2", "$3"; }