Front page | perl.beginners |
Postings from December 2002
Parse instruction file
Thread Previous
From:
William.Ampeh
Date:
December 18, 2002 10:24
Subject:
Parse instruction file
Message ID:
OFD34723DF.5F2AD2E1-ON85256C93.005B86F0@frb.gov
Hello,
I am trying to write a WEB page equation finder for files with the
following contents, and I think I am getting stuck (the program runs very
slowly, and at times I am not able to get all the variables. So I will
very much appreciate any help. Basically, I am trying to generate a Hash
of Hash from a text file with the following contents:
-----------------------------------------------------------BEGIN DATA
LINES-------------------------------------------------------------------------------------------
type "CALCULATIONS FOR TRANSACTION F.203 (NET INTERBANK CLAIMS) ARE
COMPLETE"
--******************************************************************************
--******************************************************************************
--CHKDEP
-- F.204 CHECKABLE DEPOSITS AND CURRENCY
-- WRITTEN BY DXB ON 10/15/90
-- SERIES OF CALCULATIONS FOR TABLE F.204 -- CHECKABLE DEPOSITS AND
CURRENCY
--******************************************************************************
----------------------------------- BORROWING
----------------------------------
-- --- SCBTOTAL ---
set fa713120005.q = fa713123105.q +fa713122605.q +fa713125005.q
--] MONETARY AUTHORITY = US GOVT
CASH &
--] DEPS, FOREIGN DEPOSITS, AND
CURRENCY
--] OUTSIDE BANKS (FROM DEP)
-- --- SCBTOTAL ---
set fa903023105.q =fa723123105.q +fa713123105.q -fa313020005.q --] USG MAIL
FLOAT = US GOVT DEPS AT BANKS
--] (FROM DEP) AND DEPS WITH THE
MONETARY
--] AUTHORITY LESS TOTAL CASH
BALANCES
--] (FROM FISCAL ANALYSIS)
set fa883011105.q = fa313011105.q +fa713011203.q --] US GOLD STOCK AND
SDRS = US GOVT, EX STAB
--] FUND AND MONETARY
AUTHORITY
------------------------------------ LENDING
-----------------------------------
set fa153020005.q =fa793120005.q -fa313020005.q -fa263020005.q
-fa103020000.q &&
-fa113020003.q -fa133020003.q -fa213020005.q -fa443020005.q &&
-fa473020000.q -fa513020003.q -fa543020003.q -fa573020005.q &&
-fa223020003.q -fa613020003.q -fa633020003.q &&
-fa663020003.q -fa403020003.q -fa743020003.q -fa903029005.q &&
-fa603020003.q -fa643020003.q
--] HOUSEHOLDS (RESIDUAL) = TOTAL
LESS US
--] GOVT, FOREIGN, NONFIN.
--] CORP., NONCORP. NONFIN., FARM,
STATE &
--] LOCAL GOVT, CREDIT UNIONS, PROP
&
--] CASULTY INSURANCE, LIFE
INSURANCE,
--] PRIVATE PENSION FUNDS, STATE &
LOCAL
--] GOV'T RETIREMENTS, FIN. COS.,
MONEY
--] MARKET MUTUAL FUNDS, MUTUAL
FUNDS,
--] BROKERS AND DEALERS, SPONSORED
CREDIT
--] AGENCIES, AND COMMERCIAL
BANKS,BPT
-------------------------------------------------------------END DATA
LINES------------------------------------------------------------------------------------------------
So that, with the following lines of codes:
foreach $family ( keys %DATA ){
if ( $family =~ /\d/ ){
print "$family = {", @{ $DATA{$family} }, "}\n";
}
}
The script will produce:
$DATA{fa713120005.q} = {fa713123105.q,fa713122605.q,fa713125005.q}
$DATA{fa903023105.q} = {fa723123105.q,fa713123105.q, -fa313020005.q}
$DATA{fa883011105.q} = {fa313011105.q +fa713011203.q}
$DATA{fa153020005.q} = {fa793120005.q, -fa313020005.q, -fa263020005.q,
-fa103020000.q, -fa473020000.q, -fa513020003.q, -fa543020003.q,
-fa573020005.q,-fa223020003.q, -fa613020003.q, -fa633020003.q,
-fa663020003.q, -fa403020003.q, -fa743020003.q, -fa903029005.q,
fa603020003.q, -fa643020003.q}
Thank you all.
William
Thread Previous