Hi there dear Monks, I'll start explaining my situation before I ask the question. I have to write an application that sends some data to a module over tcp/ip which contains information for this module. This data itself is a record of information formed like :
[from][to][typea][typeb][message]
Note that all these fields can get big (up to 10 MB per field). So
[script1.pl-> Makes ItemData from some fields and puts it as rawdata in a database ] ---> DBI ---> <--- DBI <--- [script2.pl-> reads ItemData from a database sends this data over a socket which is connected with script2 script1.pl knows nothing about the structure of ItemData and also doesn want to know. ] --> TCP/IP ---> <-- TCP/IP <--- [script3.pl recives ItemData and knows how ItemData is formed script3.pl will get all the fields in ItemData and will use this to talk to hardware with it .. (for example a FAX modem or an SMS machine or whatever .. not importand yet) ]
Ehm.. intro is getting to big :) so the Question : What to do with "ItemData" ? (mainly at script3.pl of course. generating it isn difficult) This is my test.pl, maybe you Monks know a better way to deal with my "ItemData" problem ?
$Ione = "Item|One"; $Ione =~ s/\|/\&verti\&kaal\&stre\&epke\;/g; $ItemData = "$Ione|Ite\@m tw\%o|It\"em Th\$ree|Item \\our|Item \'five| +Item \/six"; # # Should be split up in : # Item|One # Ite@m tw%o # It"em Th$ree # Item F\our # Item 'five # Item /six # print $ItemData."\n\n\n"; @words = split(/\|/, "$ItemData"); for (@words) { s/\&verti\&kaal\&stre\&epke\;/\|/g; print $_."\n"; }

In reply to splitting Any data on a delimiter an putting it back togetter by freax

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.