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

ummm... definitely not Bash. Actually, exec and eval are fundamental Perl... http://www.perldoc.com/perl5.8.0/pod/func/eval.html http://www.perldoc.com/perl5.8.0/pod/func/exec.html
--
-- GhodMode

Replies are listed 'Best First'.
Re: Re: Re: understanding eval in HPOJ
by Vautrin (Hermit) on Apr 04, 2004 at 20:31 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.
Re: Re: Re: understanding eval in HPOJ
by ambrus (Abbot) on Apr 06, 2004 at 17:48 UTC

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