in reply to Re: Creating a table from raw data!
in thread Creating a table from raw data!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Creating a table from raw data!
by BioLion (Curate) on Nov 19, 2009 at 17:59 UTC | |
OK, but I am still struggling a little bit - what is the actual contents of @Colum_A?:
If it is a long array like you say then why not take a simple approach?:
This produces what you seem to be looking for: Read more... (2 kB)
Update bugfixed code... Note to self - DO NOT POST UNTESTED REGEXES...
Just a something something...
| [reply] [d/l] [select] |
by blackadder (Hermit) on Nov 19, 2009 at 19:09 UTC | |
I started again Now; I have this data in colum A in excel And i want to create a data structure like this So I put this PERL script together to do the job; When I ran the script I get this output, which is wrong Could someone for the love of God or Perl tell me where am I going wrong and what can I do to get it right? THANKS A BUNCH
Blackadder
| [reply] [d/l] [select] |
by graff (Chancellor) on Nov 19, 2009 at 22:24 UTC | |
Note the extra close-curly-brace. I think if you change it to read as follows: there won't be a syntax error, and it might behave better. Apart from that, there's a warning from this line: The ", $/" part does no good at all -- the warning is "useless use of a variable in void context". Just remove those four characters. There's nothing more I can say, because I don't use windows or Win32::OLE. To read from an Excel file, I use Spreadsheet::ParseExcel, which works fine. | [reply] [d/l] [select] |
by johngg (Canon) on Nov 19, 2009 at 23:32 UTC | |
I'm not sure if this the sort of data structure you are after. It isn't the same as your structure but I think it reflects the hierarchy implied by your data. I have hopefully managed to replicate the sort of data you have in the spreadsheet in my @sanData array.
The Data::Dumper output.
I hope this is helpful. Cheers, JohnGG | [reply] [d/l] [select] |
by BioLion (Curate) on Nov 20, 2009 at 10:18 UTC | |
I bugfixed my code... I shouldn't post untested stuff! It seems to give what you are after. graff and johngg have also given you good approaches, so hopefully you are all set now. It seems like getting the data wasn't the problem, but creating and navigating complex datastructures - whenever I am having problems like this, i find perldsc and perlref very helpful for avoiding frustrations! And as far as deciding on the most appropriate datastructure, that is really down to experimenting and seeing what works for you!
Just a something something...
| [reply] |