If you start a job in the foreground (my $cmd = qq{nohup ./perl.pl};),
then the process id (PID) and process group (PGRP) will match,
because perl will exec the program directly.
If you start a job in the background (my $cmd = qq{nohup ./perl.pl &};),
then the process id (PID) and process group (PGRP) will NOT match,
because perl notices the shell meta-character '&' and execs
a shell directly, and the shell will exec the program.
The PGRP you are seeing is the PID of the shell that was started
solely to process the backgrounding character.
Since you're already forking, why do you need the implied fork of the '&' character too?