I use nedit too and a very similar macro (bind to ctrl+shift+P :) However may I suggest that you'd better use
use warnings;
rather than
#!/usr/bin/perl -w
which has the undesirable side-effect to enable warnings in modules you use, and some really can't stand it (CGI.pm for instance).
BTW here's my macro, which uses "which" to determine the path to perl :
set_language_mode( "Perl" )
myperl=shell_command( "which perl" , "" )
insert_string("#!" myperl "\n\nuse strict;\nuse warnings;\n")
set_cursor_pos(100)