Your probably best off not using Data::Dumper, because to handle this in C++, you're going to need to write a parser/interperater for a signifigant subset of perl. (update: or, see below, you can put perl inside your C++ program.)

You could also try Data::Denter which should be more easily parsed then Data::Dumper's output.

You could also have your perl code write out the structures in a format designed specifically for the C++ program to easily read. How complex this syntax would be would depend on how complex the data you are reading is, though in many cases you could probably make it pretty simple (e.g. a flat file, key on one line, number of lines in value on the next. This is pretty easy to parse in C++.)

Another option is too embed a perl interperator in your C++ program, or embed C++ in the perl program, and have your C++ use perl's API. But, this may very likely be inappropriate for your situation. update: for information on putting perl inside your C++ program see perlembed. For putting C++ in perl see perlxs.


In reply to Re: perl Data::Dumper'ed to C++ by wog
in thread perl Data::Dumper'ed to C++ by Ntav

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.