[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Wow. $/ = '\00'; (and secret meeting tonight)



Have I freaked out lately about how cool Perl is?

This morning I was sent data like this:

--------------------------
01/03/07 11:12:57: Type B msg to HRS, ars=AA, hrs=OM, msg #
280259B8FB9DE4
HDRB|ARSAA|HRSOM|AADHDQRM|CTYOMA|SCTHDQ|SGAAA|SFFIC33/99999999|GMT031112
|\
7JAN07|OTD18JAN07|NNT1|NPR1|NRM1|PID15981|RMR135.00|CURUSD|RTYXDRVOP|SIN
R\
Q NON SMK RM.KING BD||GUEST|NAD1|NAMKRD F||\00

01/03/07 14:42:31: Type B msg to HRS, ars=UA, hrs=OM, msg #
281F59BC0D7F57
BM|SINNSRM||GUEST|NAD1|NAMPXXXXXXXXXXXXI|NNA1|NNMPAXXXXXXXXXXXXXXXAS|AD1
A\
MERICAN EXPRESS\r\n8415 DATAPOINT XXXXXX XXXXXXXX\r\nSAN ANTONIO TX
78229\
 USA||FLIGHT|TXTAA330S04JAN DFWIAH HK1/0830P 0935P||\00

01/03/07 21:10:30: Type B msg to HRS, ars=AA, hrs=OM, msg #
280259C1BC65AF
HRSREJ|TXT\r\n@QP OMAOMHL\r\n.HDQRMAA 032110\r\n@AVH\r\n
\
                              \r\nOM576875,935259,396345
\
        \r\n ASSIGNED                                      \r\n     FOR
\
                                     \r\n||\00
--------------------------

And Perl just eats it up...


$/ = '\00';
open (IN, "log");
while (<IN>) {
   s/\\\n//g;
   my ($act) = /\|ACT(\w+)/;
   my ($cnf) = /\|CNF(\w+)/;
   print "[$act][$cnf]\n";
}
close IN;


Unreal.


Incidentally, out secret monthly meeting is tonight. It's a secret, so
don't tell anybody.

   http://omaha.pm.org

:)

j