gfarhat has asked for the wisdom of the Perl Monks concerning the following question:

How can i use perl in a ksh script?

what im trying to do is

#!/bin/ksh var=`command ....` <perl script to process $var>
i know i can write it all in perl. but i trying to find a way to write it all in ksh

Replies are listed 'Best First'.
Re: perl in ksh
by Corion (Patriarch) on Apr 15, 2008 at 12:33 UTC

    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.

Re: perl in ksh
by moritz (Cardinal) on Apr 15, 2008 at 12:34 UTC
    command ... | perl your_perl_script.pl

    And in your_perl_script.pl read the data from STDIN.

Re: perl in ksh
by sasdrtx (Friar) on Apr 15, 2008 at 13:33 UTC
    What is the requirement for ksh? This would be logically simpler if you just made it all Perl.
    i.e.
    #!/bin/perl -w my $var = `command...` # ...whatever...
    sas
Re: perl in ksh
by Fletch (Bishop) on Apr 15, 2008 at 12:28 UTC

    The Perl interpreter is an executable just like any other you would run from any shell. Consult perlrun for information on handy options such as -e which make running snippets of perl (aka "one liners") from other programs easy.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.