http://qs1969.pair.com?node_id=109693


in reply to Perl embedded in Kornshell

You can't just stick perl in front of a shell script. Why not just make the the whole thing a perl script. The only thing you're doing in shell is passing the contents of two files to be acted upon, and then redirecting the output to another file. Pick a language. Do it with either perl or ksh.

In Perl (since this is Perl Monks) just open each file:
open(FILE1, "/home/spjal/files/bprcf.parms") || die "Dead on file open. $!\n";

I don't know how the contents are arranged in your files, but suck out its tasty fillin':

my($scheck, $echeck); while(<FILE1>) { chomp; ($scheck, $echeck) = split; # or whatever. } close(FILE1); # Be tidy.

Do the same to the other input file, twist and spindle the data to your nefarious ends, and then open an output file:

open(OUTFILE, ">/home/spjal/files/bprcf.tmp") || die "Dead on file ope +n. $!\n"; print OUTFILE "Important results.\n";

You have many more issues to deal with regarding your Perl syntax. You're omitting semi-colons at the end of each statement. Arguments are passed via the special @ARGV array, not the "numbered" variables. $1, $2, etc. do something else in Perl. Instead of else if, you use elsif. Try the handy Tutorials section.