Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

hash by reference Issue of getting same sequence issue

by tilak_sai
on Oct 08, 2008 at 11:31 UTC ( #715980=perlquestion: print w/replies, xml ) Need Help??

tilak_sai has asked for the wisdom of the Perl Monks concerning the following question:

sub Msg { my $line = shift; my ($pf,$fixFields) = split(/received:|Sent:/, $line); my %fixMsg; %fixMsg = split(/[,=]/, $fixFields); @fixMsg{('_time_', '_mi_', '_fixsession_')} = (split(/\|/, $pf))[2 +,3,5]; return \%fixMsg; } open file,"abc.txt" while(<file>) { $msg=pfUtils::Msg($_); foreach my $key (%{$msg}) { if (!($key eq _mi_|$key eq _fixsession_|$key eq _time_|$msg->{ +$key} eq '')) { printf "\n\t%20s (%3d) = %s ", $code,$key,$value; } } } close file;
File "abc.txt" contains the following:
^|server |13:20:52.423762|pht0211j-hello|DebugLow|NAQ|PXXXX thread +started. Thread ID=-1349444688.|<> ^|Server |13:20:52.425505|pht0211j-hello|DebugLow|Sian01|Sian01 Sen +t: 8=FIX.4.2,9=65,35=A,34=1,49=FBCO20,56=CMS,52=20080111-18:20:52,43= +N,98=0,108=60,10=133|<> ^|Server |13:20:52.425602|pht0211j-hello|InfoGeneral|Sian01|SiacCon +n001 Logon : 8=FIX.4.2,9=65,35=A,34=1,49=FBCO20,56=CMS,52=20080111-18 +:20:52, 43=N,98=0,108=60,10=133|<> ^|server |13:20:52.647996|pht0211j-hello|InfoGeneral|abc|Starting A +BC link: Abxxx|<>

Replies are listed 'Best First'.
hash by reference Issue of getting same sequence issue
by tilak_sai on Oct 08, 2008 at 11:43 UTC
    sub Msg { my $line = shift; my ($pf,$fixFields) = split(/received:|Sent:/, $line); %fixMsg; %fixMsg = split(/[,=]/, $fixFields); @fixMsg{('_time_', '_mi_', '_fixsession_')} = (split(/\|/, $pf))[2 +,3,5]; return \%fixMsg; } open file,"abc.txt" while(<file>) { $msg=pfUtils::Msg($_); foreach my $key (%{$msg}) { if (!($key eq _mi_|$key eq _fixsession_|$key eq _time_|$msg->{ +$key} eq '')) { printf "\n\t%20s (%3d) = %s ", $code,$key,$value; } } } close file;
    File "abc.txt" contains the following:
    ^|server |13:20:52.423762|pht0211j-hello|DebugLow|NAQ|PXXXX thread +started. Thread ID=-1349444688.|<> ^|Server |13:20:52.425505|pht0211j-hello|DebugLow|Sian01|Sian01 Sen +t: 8=FIX.4.2,9=65,35=A,34=1,49=FBCO20,56=CMS,52=20080111-18:20:52,43= +N,98=0,108=60,10=133|<> ^|Server |13:20:52.425602|pht0211j-hello|InfoGeneral|Sian01|SiacCon +n001 Logon : 8=FIX.4.2,9=65,35=A,34=1,49=FBCO20,56=CMS,52=20080111-18 +:20:52, 43=N,98=0,108=60,10=133|<> ^|server |13:20:52.647996|pht0211j-hello|InfoGeneral|abc|Starting A +BC link: Abxxx|<>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://715980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2020-02-19 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (80 votes). Check out past polls.

    Notices?