in reply to understanding eval in HPOJ

I think that this is bash code, not perl. But I must admit that I don't quite understand it either.

Replies are listed 'Best First'.
Re: Re: understanding eval in HPOJ
by GhodMode (Pilgrim) on Apr 04, 2004 at 20:25 UTC
      I think the poster may have been referring to the fact that it uses environmental variables.

      Want to support the EFF and FSF by buying cool stuff? Click here.

      It reminds me to some code by which you can run the same script under bash and perl too. One variant of such code is:

      #!/bin/sh -- # -*- perl -*- -p eval 'exec perl -wS $0 ${1+"$@"}' if $running_under_some_shell;

      This has both eval end exec.

      The more sophisticated one is:

      #! /bin/sh eval '(exit $?0)' && eval 'PERL_BADLANG=x;PATH="$PATH:.";export PERL_B +ADLANG\ ;exec perl -T -x -S -- "$0" ${1+"$@"};#'if 0;eval 'setenv PERL_BADLANG + x\ ;setenv PATH "$PATH":.;exec perl -T -x -S -- "$0" $argv:q;#'.q #!perl -wi.bak +push@INC,'.';$0=~/(.*)/s;do(index($1,"/")<0?"./$1":$1);die$@if$@__END +__+if 0 ;#Don't touch/remove lines 1--7: http://www.inf.bme.hu/~pts/Magic.Perl +.Header

      (Which runs under csh too).