in reply to Re: Re: understanding eval in HPOJ
in thread understanding eval in HPOJ

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).