I'm stuck fellow monks,
Okay this is the first time I've run into non-fixed data.
What I mean by that is that the data is in a block structure but certain lines of the data are on different lines most of the time.
Normally I'd use $/ to break down the blocks into paragraphs and print out $line 2 or whatever line. However now I can't do that because let's say
$line 2 was dog but in my data dog could be on line 5 so if I said:
print "$line 2";
I'd have it printing cat.
So I was wondering how with a data structure as below could you print out the following lines of data without knowing what line they'll be on.
I was reading through the camel book and it sounds like I need to make a hash of arrays but the example wasn't what I wanted it prints out the ARRAY value like (0xcf02)
some crazy stuff like that. I want it to print out the value I typed into it. Anyway do I have the right idea to make a hash of arrays for the below data in order to print out a line that isn't
always in the same location. For example the lines: "interruptionTime", "chargeParty", "disconnectingParty". Lets say those are the 3 lines I wanted to print and in one record block "interruptionTime"
could be on line 2 and in the next block line 18. Here is an example of the data:
PCSPLMNCallDataRecord
mSTerminating
callIdentificationNumber 2487067'D
relatedCallNumber 2487060'D
recordSequenceNumber 7410342'D
exchangeIdentity "MAPP01E 0117802"'S
mSCIdentification 1119207079800F'TBCD
cellIDForFirstCellCalled 13F046044D55B5'H
incomingRoute "BAPL01I"'S
outgoingRoute "BAPL01O"'S
callingPartyNumber 146084466642'TBCD
calledPartyNumber 1116084466643F'TBCD
iMSICalled 13600410005231F1'H
mobileStationRoamingNumber 1116084469970F'TBCD
redirectionCounter 0'D
dateForStartOfCharge 1 8 28'BCD
timeForTCSeizureCalled 170F25'H
timeForStartOfCharge 23 15 44'BCD
chargeableDuration 0 0 11'BCD
trafficActivityCode 11 2 14'BCD
teleServiceCode 11'H
internalCauseAndLoc 0 3'BCD
timeFromRegisterSeizureToStartOfCharging 0 0 9'BCD
timeForStopOfCharge 23 15 55'BCD
interruptionTime 0 0 0'BCD
typeOfCallingSubscriber 1'D
disconnectingParty 0'D
chargedParty 1'D
eosInfo 00'H
callPosition 3'D
originForCharging 1'D
cellIDForLastCellCalled 13F046044D55B5'H
locationNumberTerminating 114141079808F0'H
tariffClass 10'D
tariffSwitchInd 0'D
firstAssignedSpeechCoderVersion 01'H
speechCoderPreferenceList 0100'H
firstRadioChannelUsed 00'H
radioChannelProperty 01'H
presentationAndScreeningIndicator 30'H
So any ideas on how I can achieve this, and is my idea headed in the right direction with a hash of arrays?
The Brassmon_k
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|