The code is from the file hpoj (no extension), which is installed as part of the hpoj-0.90-14 RPM for RedHat Linux 9. It's 1339 lines long, but here are lines one through six: unchanged...

#!/usr/bin/perl # LANG=C is a work around for bug 82652. # The easier work-around of setting LANG=C in perl script itself didn' +t # work. It's probably too late by then. eval '(exit $?0)' && eval 'exec env LANG=C $0 ${1+"$@"}' if $ENV{"LANG"} != "C";

Really?! No one is familiar with exec and eval?

eval "evaluates" perl code or an expression and exec terminates the currently running Perl script and executes it's arguments in the current shell, ie: without creating a new process ID.

There is no eval command in Bash, but the exec command does work in a similar fashion, executing it's arguments without creating a new process.

I think both execs are actually based on a similar function in the standard programming library for Unix-like operating systems.

--
-- GhodMode

In reply to Re: Re: understanding eval in HPOJ by GhodMode
in thread understanding eval in HPOJ by GhodMode

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.