in reply to extracting data and saving into seperate files

Hm, I'd separate these into "chunks" that are each a file, and worry those apart later. Something like this:

open INFILE, '<', 'infile.txt' or die("Can't read: $!"); # each 'line' is a chunk with 'filename =' delimiting. local $/ = 'filename ='; while (<INFILE>) { s/^s\+//s; # remove starting whitespace. # use a regex capture -- slow but simple. my ($filename, $data) = ($1, $2) if m/^(\w+)\s+pred=\s+(.*?)\s+$/s; open my $OUT, '>', $filname or die("Can't write $filename: $!"); foreach ( split(/\s+|\n/, $data) ) { next unless m/^[-.0-9][0-9.]+/; #skip any empty or malformed lin +es print $OUT $_; } }

Untested, but the principle is sound and somewhat reusable.

<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law