Update: So on a second read I think you're telling us that line five of your code is the open statement. The error message you're getting is because the open is failing. The failure could be for any one of a number of reasons: no permission to open the file, or the file doesn't exist where you're looking, among other possible reasons. If your die statement were replaced with or die $!, then your error message would give you more info as to what might be the problem. We certainly haven't been given enough information to provide a complete diagnosis.


The remainder of this post is my original mistaken reaction to the unclear question.

The error is in (or possibly right before) line five of nextline.pl. If line five of nextline.pl is this:

#ifndef __COBRA_H_EXTERNAL_GUARD__

... then the problem could be that #ifndef __COBRA_H_EXTERNAL_GUARD__ is not Perl, it's a preprocessing directive for the C or C++ preprocessor. You can't feed C directly to perl and expect it to know what to do with it.

On the other hand, if #ifndef __COBRA_H_EXTERNAL_GUARD__ is line five of your input file (which is probably the case), then you're barking up the wrong tree. We would need to see line five of your Perl script (and probably a few lines on either side of line five). Your program is failing on line five of the Perl script. Not on line five of the input file.

Before posting additional information be sure to read Writeup Formatting Tips so that you can make your post legible.


Dave


In reply to Re: Open file .h error by davido
in thread Open file .h error by sunnyni

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.