in reply to Not a CODE reference … my 1st script

You can't take a reference to a subroutine and initiate it by passing parameters at the same time. Use an anonymous sub instead.
push @device_thread, threads->new(sub {thread_job($key, $device_ip{$ke +y}, $index)})->join;