in reply to unique filename

I think it is pretty straight forward:
if (-e $name) {
basically check if the file exists or not. And you know about this already I suppose.
-e ($name = $name."_$i")
in the for loop basically loop over the file. It has the same meaning as if you do this:
my $name = $name."_$i"; # input file name open ( INF, '<', $name ) or croak "$0 : failed to open output file $name : $!\n"; while(<INF>) { # Do something } close ( INF ); # close input file
Finally, read -X.



---
neversaint and everlastingly indebted.......