in reply to to divide/split a file to small files.

You can use arrays as filehandles, so any number of files can simply be handled in a loop. The only thing to observe is how to use the filehandles with print:

open ($f[$x],'>','test$x.txt') or die ... ... print { $f[$y] } "whataniceview\n";

You can read about it with 'perldoc -f print' and 'perldoc -f open'