Hello All,

 

I found this in Programming Perl - 3rd edition. Could not understand how
this works.

 

#!/bin/sh -- # perl, to stop looping

eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'

    if 0;

 

Questions:

 

-          Who (I mean which program/shell) runs eval 'exec .'?

-          What is ${1+"$@"}, looks like this makes up the command line
arguments to the script?

-          What is the purpose of 'if 0;' on a new line?

 

'perldoc perlrun' documents that -S switch makes perl search $PATH for the
script.

 

 

Thanks,

Gowtham

 

Reply via email to