Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Problem while Data Extraction

by Anonymous Monk
on Dec 04, 2012 at 03:24 UTC ( #1006983=note: print w/replies, xml ) Need Help??


in reply to Problem while Data Extraction

The data between "|" need to be saved as it is without the spaces and data outside pipes need to be converted to ASCII.

Can you explain this better, like give an example?

Replies are listed 'Best First'.
Re^2: Problem while Data Extraction
by jpvinny28 (Initiate) on Dec 04, 2012 at 03:30 UTC

    Input =|14 0D 2A|abc

    Output =140D2A616263

    The values within two pipes is hexadecimal data.. so I need to keep the values as it is in output and value outside the pipe I need to convert to ascii equivalent (abc=61,62,63) in the above example

      my @F = split(/\|/, $_, 0); foreach $_ (@F) { if (/^[\da-z]{2}(?:\s[\da-z]{2})*$/i) { s/\s+//g; print $_; } else { print unpack('H*', $_), $/; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006983]
help
Chatterbox?
[ambrus]: Corion: four days a week? hmm
[Corion]: ambrus: I did that in 2012 and 2013, to try it out, and I found the available time to be worth more to me than the money
[Corion]: I've started that again this month (now forever instead of a limited time), and it already destresses me a lot
[holli]: There are Anti Vaxxer weeks at IKEA.
[Corion]: Of course, it's a 20% cut in the money I receive, while the work doesn't necessarily reduce at all, but my approach is to make the work take longer instead of fitting 5 days worth of work into 4
[holli]: 50% off all children coffins.
[Corion]: holli: Ooof :)
[hippo]: Cut should beless than 20% after tax, though. :-)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-09-21 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (249 votes). Check out past polls.

    Notices?