in reply to #! question

The purpose of this to ensure that it runs correctly on machines which have a broken shell which does not respect the #! line. Thus, one can run it as ./script.pl or perl script.pl and it wull function identically.

It does look rather strange, though, as most versions that do this have #!perl as the first line -- this one seems to be forcing the shell to exec it explicitly. Strange, but I see no reason why it wouldn't work. It might confuse some webservers that arn't overly smart, though.

Update: I sit corrected. I'd never seen this construction used in that way before, only for broken-shell prevention.

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Replies are listed 'Best First'.
Re: Re: #! question
by belg4mit (Prior) on Jan 17, 2002 at 03:49 UTC
    Actually no, not really. The purpose of this is to set a perl script to run on a given machine without knowing where the binary lives, with the limitation that it be in your PATH.

    UPDATE: Further, as covered elsewhere #! is the kernel's responsibility not the shell's.

    --
    perl -pe "s/\b;([st])/'\1/mg"