in reply to perl in ksh
See perlrun about the -x switch. Or just write your Perl program as a separate file and launch that from your ksh script with $var as a parameter.