Looks like a variation of CSV, so I am triggered :)
Changing the | to a TAB is left an exercise to the user :P
$ perl -MText::CSV_XS=csv -MData::Peek -e'DDumper csv (in => "test.csv +", key => "TICKER", sep => "|", allow_whitespace => 1)' { AB => { 'CO. NAME' => 'Alpha Beta', INDUSTRY => 'Materials', 'MARKET CAP' => 2500, PRICE => 12, TICKER => 'AB' }, ABC => { 'CO. NAME' => 'ABC Co.', INDUSTRY => 'Industrials', 'MARKET CAP' => 5000, PRICE => '15.5', TICKER => 'ABC' }, DOZ => { 'CO. NAME' => 'ZZZZZ', INDUSTRY => 'Telecom', 'MARKET CAP' => 2800, PRICE => '5.05', TICKER => 'DOZ' }, DX => { 'CO. NAME' => 'DX Co.', INDUSTRY => 'Industrials', 'MARKET CAP' => 12000, PRICE => '77.2', TICKER => 'DX' }, DXX => { 'CO. NAME' => 'DXX Co.', INDUSTRY => 'Utilities', 'MARKET CAP' => 9000, PRICE => '50.25', TICKER => 'DXX' } }
In reply to Re: Reading Text File into Hash to Parse and Sort
by Tux
in thread Reading Text File into Hash to Parse and Sort
by Perl_Derek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |