in reply to Define(@array) is Deprecated

I might be wrong, but it looks like $links is (or should be) a hash of array refs, in which case it doesn't make sense to me to use the @{$links{$elementname}} instead of simply defined( $links{$elementname} ) to see if the element has been populated to begin with.

In fact, it looks like you need to check for the element's existence and if it has members in the array being referenced by it. I'd have to double check, but I think doing if ( @{$hash{element}} ) might throw a warning if the element does not exist or contains undef.

It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.