in reply to limit stacksize unlimited

I will assume you are running a UNIX or UNIX like system. You can increase the stacksize limit on a per process bases (limits will be inherited by child processes). So calling ulimit in a system just by its own will set the limit for the spawned process, which then terminates.

What you probably want is:

system "ulimit -s unlimited; your_fortan_program";
That will start a shell, in the shell you increase the stack size limit, and then the shell calls the Fortran program, which will inherit the setting.

Or you could increase the stack size limit before you call your Perl program.