in reply to Re^2: Running Perl scripts from ssh
in thread Running Perl scripts from ssh

Part of your script is still running - that's why ssh doesn't terminate the connection:

... my $pid = fork(); ...

You need to detach your child process from the parent process - maybe it's enough to close STDIN and STDOUT, but I'd use Proc::Daemon or what perldoc -q daemon says to start the program detached in the background:

use POSIX qw(setsid); close STDIN; close STDOUT; close STDERR; # or better, reopen them into some logfile setsid(); fork && exit; # We are now detached from ssh

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.