Perl will work the same regardless of whether it is on Solaris or HP-UX. For shell scripting as well, ksh is available on both systems, so scripts written for ksh on HP-UX will work under ksh on Solaris. The sh shell in HP-UX is supposed to be a fully
POSIX compliant shell, but usually scripts wouldn't be written to take advantage of that.
Of course, there are some very major differences - if your script is using any HP-LVM commands for instance, it is, of course, not going to work under Solaris.