open (DATA,"$input_file") || eval { print "Can't open file $input_file: $@"; exit; };

BTW: Are you aware that this is a very strange error handler for an open statement? As best I can figure, it uses an eval expression to print the value of a previous (Update: No! See below.) eval error ($@ - see perlvar; in particular, Error Variables) as the file open error message. Why not just use a 'standard'
    open my $fh, '<', $input_file or die "opening '$input_file': $!";
(see $! in perlvar and Error Variables).

Update: A simple experiment, which I didn't have time to do before, shows that  $@ is emptied upon entry to an eval block:

>perl -wMstrict -le "eval { die 'zot!' }; print qq{after first eval: '$@'}; ;; eval { print qq{in second eval: '$@'} }; " after first eval: 'zot! at -e line 1. ' in second eval: ''

In any event,  $@ is not the proper error variable to print after an I/O error.


In reply to Re: Parsing a long string [OT]: strange open by AnomalousMonk
in thread Parsing a long string by Anonymous Monk

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.