Help for this page
perl -ne 'if(/(\w+\.csv)/){close $fh if defined $fh;open $fh,">$1"} el +sif(/([0-9.-]+)/){print $fh "$1\n"}' file.txt
open FILE, "<file.txt"; # Open the file while( <FILE> ) { # read a line ... } close $fh; # close the files opened close FILE;