On Sat, Mar 6, 2010 at 8:39 AM, Peter Scott <pe...@psdt.com> wrote:
> On Fri, 05 Mar 2010 11:42:34 -0500, Jay Savage wrote:
>
>> On Thu, Mar 4, 2010 at 2:12 PM, YAPH <yet.another.perl.hac...@gmail.com>
>> wrote:
>>
>>> I got a perl script that begins like this.
>>>
>>>
>>> #!/usr/bin/sh -- # -*- perl -*-
>>>
>>> eval 'ORACLE_HOME=/opt/oracle; export ORACLE_HOME;LD_LIBRARY_PATH=/opt/
>>> oracle/lib; export LD_LIBRARY_PATH; exec /bin/perl  $0 ${1+"$@"} ;' if
>>> 0;
>>
>>
>> This isn't a Perl script. This is a shell script to be executed by
>> whichever shell lives at /usr/bin/sh on your system.
>
> And to explain the comment "# -*-perl-*-" - this tells editors (Emacs for
> one) that the code is Perl (if the filename doesn't end in .p[hlm] and
> the #! doesn't have a path to perl in it, the autodetection won't work),
> thereby causing the editor to switch to Perl syntax mode.
>

More importantly, "-*-and "- " have special behavior with regard to
the perl interpreter that allows the interpreter to ignore the
irrelevant bits of the shell script that would otherwise cause errors
in the trick used above, while still allowing the emacs hack. See
perlrun for details.

-- j

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to