Hello CSharma,

only two remarks. First do not use XML::Simple anymore. As stated in the module's documentation it's use is deprecated. Personally i choosed XML::Twig and I'm happy with it. Specially if your xml data is big and complex you'll enjoy the ability of XML::Twig to parse XML using handlers. Might be that your case is few lines of Perl codes and one line of XML::Twig handler.

Second point the below lines of your codes does not make much sense to me:
foreach my $d (keys %{$doc->{'results'}{'result'}{'output'}{'products' +}{'product'}}) { print $doc->{'results'}{'result'}{'output'}{'products'}{'produ +ct'}{'image_link'} . "\n"; }
I read this like "foreach sheep in sheep_group print name_of_every_sheep_in_the_farm"
Why do you not use $d ?
Perhaps you intend something like (i admit i have not seen your big hash..)
foreach my $d (keys %{$doc->{'results'}{'result'}{'output'}{'products' +}{'product'}}) { print $d->{'image_link'} . "\n"; #UPDATE (was: $d{'image_link +'} ) spotted by choroba (thanks) .. i was sure i put }
HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Complex XML hash to csv by Discipulus
in thread Complex XML hash to csv by CSharma

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.