Re: #!/Perl question
Hans van den Boogert wrote:
> I'm trying to learn some Perl. I found an on-line book which is Unix
> biased, but the scripts all start with #!/usr/local/bin/perl (which makes
> sense if you have compiled and installed it yourself). However, on my
> Debian system Perl was of course put in /usr/bin/perl. So how can I write a
> Perl script that be executed on a variety of systems (Unix/Linux/DOS)??
This will work no matter where your perl executable is. Won't work under dos
though, probably. Note the perl script doesn't start with any #! at all, and
is first run as a shell script (the kernel knows where the shell is, and
runs it), then as a perl script (the shell has perl on it's path, and runs
it).
eval 'exec perl -S $0 ${1+"$@"}'
if 0;
print "hello, world\n";
# More perl code here
--
see shy jo
Reply to: