in reply to split a file
Your loop body is executed for each line in the input file.
Inside the body, you create an output file containing exactly one line. Because of the way your write the "open", any previous file of the same name will be destroyed - you need to open in append mode to keep the old contents, for instance:
open(my $out,'>>',"Int_$num.txt") || die "Can not open $num-file for a +ppending ($!)";
|
|---|