[comp.lang.perl] program, __END__, data all in one file

weisberg@hpcc01.HP.COM (Len Weisberg) (07/24/90)

Larry wrote in another string:
>
> after the next patch you'll be able to
> run this article through perl -x and it will print out "howdy".
>
> #!/usr/bin/perl
> $_ = <STDIN>;
> print;
> __END__
> howdy
>
> Think a little about the possible implications of that.

Well, you could write a ksh script like:

{ cat <<END_OF_PERL_PROGRAM
  ...
  ...  perl code goes here ...
  ...   (for a filter using <STDIN>  and <STDOUT> )
  ...
__END__
END_OF_PERL_PROGRAM

shell | commands | and | stuff | to produce | input to perl program
}  |  perl -x \ 
| other | commands | to process | output from perl program


Now perhaps I should do it all in perl, but then again, maybe not.
It's nice to have the option of having a perl filter in a self-contained
ksh script without the dreaded -e stuff.

Larry, was this prompted by my question to you in Mountain View the other day?

Thanks, 

- Len Weisberg - HP Corp Computing & Services - weisberg@corp.HP.COM