I'm trying to understand the following snippet of code, which doesn't seem to be working for me.
eval '(exit $?0)' && eval 'exec env LANG=C $0 ${1+"$@"}' if $ENV{"LANG"} != "C";
What's happening in each eval? Here's what it looks like to me. Please correct me...
  1. It's just sticking a 0 on the end of the end of the exit status for the last child process and exiting. But there is no last child process.
  2. Set LANG=C then execute the current script again with an argument that is somehow made from a 1 and the code for the syntax error from the first eval
I'm very confused. This is a work-around for a bug with HP OfficeJet printer support on RedHat Linux. Since it's not working I was thinking of using this adaptation from another thread which helped me solve another, unrelated problem...
BEGIN { unless ( $ENV{LANG} eq "C" ) { $ENV{LANG} = "C"; exec 'env',$0,@ARGV; } }
I will be posting a question of this nature in their mailing list, too. But the Monks are much better :) Thank you,
--
-- GhodMode

In reply to 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.