Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Using Perl and WriteExcel to split data from one column to many others

by squarez (Initiate)
on Oct 03, 2012 at 01:25 UTC ( #996952=note: print w/ replies, xml ) Need Help??


in reply to Re: Using Perl and WriteExcel to split data from one column to many others
in thread Using Perl and WriteExcel to split data from one column to many others

Also thank you for the help. I am currently thinking of:

while ($res[$o] = $sth->fetchrow_array()) { <code for splitting current array segment, and then printing the c +orresponding splits into the next columns sequentially.> }

I am thinking possibly another loop with an array to populate each rows values, then writing within that sub loop to each row column.


Comment on Re^2: Using Perl and WriteExcel to split data from one column to many others
Download Code
Re^3: Using Perl and WriteExcel to split data from one column to many others
by Anique (Acolyte) on Oct 03, 2012 at 08:01 UTC

    I get the funny feeling your 'first column' is just a string like this "(a, b, c, d)" (but I might be wrong, as I am new at this) If that is the case, removing the parentheses and then splitting on the comma will fix your issue:

    my $set = $res[0]; #I use a lot of 'extra' variables to tell me what everything is $set =~ s/[\(\)]//g; #remove all parentheses my @values = split(',', $set); #now every value should have its own spot in the array

    I hope this solves your problem.

    Please ignore me if this is a stupid answer...

      Thank you for the help, went with your solution as it proved very quick :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-07-22 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (106 votes), past polls