in reply to system($cmd) spawns infinitely

Are you sure you're not doing something like this?
print "Running: $$\n"; system "perl $0";