I finally got it!

Here is my solution and it works perfectly:

foreach $Title (keys %{$HASH}) { print $OUT "<recipe>".$Title."</recipe>\n"; my $abstract=shift @{$HASH->{$Title}}; print $OUT "<abstract>".$abstract."</abstract>\n"; my $procedure=pop @{$HASH->{$Title}}; foreach my $ingredient (@{$HASH->{$Title}}) { print $OUT "<ingredient>".$recipe."</ingredient>\n"; } print $OUT "<procedure>".$procedure."</procedure>\n"; }

__DATA__ <recipe> TORTA RICCIOLINA I</recipe> <abstract>Vi descrivo la torta ricciolina con due ricette distinte per +ché la prima avendola fatta fare, me presente, da un cuoco di profess +ione, pensai di modificarla, in modo che riescisse più gentile di asp +etto e di gusto più delicato.</abstract> <ingredient>Mandorle dolci con alcune amare, sbucciate, grammi 120.</i +ngredient> <ingredient>Zucchero in polvere, grammi 170.</ingredient> <ingredient>Candito, grammi 70</ingredient> <ingredient>Burro, grammi 60.</ingredient> <ingredient>Scorza di limone.</ingredient> <procedure>Intridete due uova di farina e fatene taglierini eguali a q +uelli più fini che cuocereste per la minestra nel brodo. In un angolo + della spianatoia fate un monte colle mandorle, collo zucchero, col c +andito tagliato a pezzetti e colla buccia del limone raschiata e ques +to monticello di roba, servendovi della lunetta e del matterello, sti +acciatelo e tritatelo in modo da ridurlo minuto come i chicchi del gr +ano. Prendete allora una teglia di rame e così al naturale, senza ung +erla, cominciate a distendere in mezzo alla medesima, se è grande, un + suolo di taglierini e conditeli cogl'ingredienti sopra descritti, di +stendete un altro suolo di taglierini e conditeli ancora, replicando +l'operazione finché vi resta roba e procurando che la torta risulti r +otonda e grossa due dita almeno. Quando sarà così preparata versatele + sopra il burro liquefatto servendovi di un pennello per ungerla bene + alla superficie e perché il burro penetri eguale in tutte le parti.C +uocetela in forno o nel forno da campagna; anzi, per risparmio di car +bone, può bastare il solo coperchio di questo. Spolverizzatela abbond +antemente di zucchero a velo quando è calda e servitela diaccia.</pro +cedure>

Thank you very much,guys!I think I'm going to love this place.

One of Crete's own prophets has said it: 'Cretans are always liars, evil brutes, lazy gluttons'.
He has surely told the truth.


In reply to Re^3: Regexp and reading a file n-lines at time by epimenidecretese
in thread Regexp and reading a file n-lines at time by epimenidecretese

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.