in reply to Re^5: Parse a file and store it in hash of hashes
in thread Parse a file and store it in hash of hashes
Thank you. I was able to parse and dump the data into a file. Is there any function to sort the cell names after they are dumped? Because everything is dumped in a haphazard manner.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Parse a file and store it in hash of hashes
by johngg (Canon) on Jan 16, 2017 at 12:22 UTC | |
Data::Dumper's Sortkeys method may help you.
Update: Amended map { split m{\s*=\s*} } @record to map { split m{\s*=\s*}, $_, 2 } @record to address afoken's point. Cheers, JohnGG | [reply] [d/l] [select] |
by afoken (Chancellor) on Jan 16, 2017 at 14:08 UTC | |
$key => { map { split m{\s*=\s*} } @record } Try that with values containing "=". Like this:
Did you expect that?
Hint: split accepts THREE arguments. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-) | [reply] [d/l] [select] |
Re^7: Parse a file and store it in hash of hashes
by Corion (Patriarch) on Jan 16, 2017 at 11:51 UTC | |
If you mean by "dump the data" that you are using Data::Dumper, have a look at $Data::Dumper::Sortkeys. If not, maybe you can show us what you mean by "dump" and "haphazard manner". | [reply] |