Try
unless (param('submit'))
to detect if perl was invoked from a form. (If you've used submit(-name=>'somename'),then substitute "somename" for "submit".)
When you just check to see if param() returns false, you're checking that there were no parameters, but when you specify "id=2" in a link, you do have a parameter. Checking for a parameter named "submit" checks if the "submit" button was clicked (or the user pressed enter), which is what lests you know the other parameters were set by the form, not a link.