The elements are confirmed to return properly

Not in your provided code.

it works for several thousand images

That translates to 'infrequent error', and to 'can process some files successfully'. As do the statements about another 15K ... .

It's always the same line, yes.

Same line in the code, or hopefully and VERY helpful in debugging: always the same $line in the INPUT!? (Update: is it always the same image file or not? See Ikegamis comment below as well! A warn "input: $line\n" is a bit verbose but will pinpoint the file in question)

Please check this and do add code to check the returns esp. from split and gd.


Update: So you say, it's not the same file triggering the error. Not so nice. Ok. Try Ikegami's code or update your own suitably. If things still fail, then change

my $gd = $image->resize(160, 120);
my $gd; eval{$gd=$image->resize(160, 120)}; do{warn "processing error for file: $line - skipping\n"; next} if $@ o +r not ref $gd;

Similar caution for the 2nd gd call. I'm assuming you've some error + sanity checking by now for the open, split and gd calls.


In reply to Re^3: Reading 60k lines in file by jakobi
in thread Reading 60k lines in file by b_gsmls

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.