Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: How to modify column in WriteExcel?

by hdb (Monsignor)
on Mar 13, 2019 at 10:16 UTC ( #1231207=note: print w/replies, xml ) Need Help??

in reply to How to modify column in WriteExcel?

A useful tool in such a situation is Data::Dumper to investigate your data structures. For example you might want to try:

use Data::Dumper; ... print Dumper $url;

Replies are listed 'Best First'.
Re^2: How to modify column in WriteExcel?
by vserzh (Novice) on Mar 13, 2019 at 10:27 UTC
    As I understand I get exactly what I need, but.. :)
    $VAR1 = [ [ '10000516' ], [ '10000512' ], [ '10000514' ], [ '10000513' ], [ '10000515' ] ];
      #!perl use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new('Report.xls'); my $worksheet = $workbook->add_worksheet("DTicket"); #my $url = $sth->fetchall_arrayref([0]); my $url = [['10000516'],['10000512'], ['10000514'],['10000513'],['10000515']]; my $rowno = 2; for my $row (@$url ){ my $url = ''.$row->[0]; $worksheet->write_url($rowno++,0, $url, $row->[0]); }
        It's works thank you very match!

      If this is the output of print Dumper $url; then you need to use $url->[0][0] instead of $url->[0] (the latter being the same as ${$url}[0]).

      Update: or ${${$url}[0]}[0] if you prefer.

        Yes, that output and thank you $url->[0][0] is works, link are valid now. Could you explain me why is two pointers here [0][0]? And another question can I use for/foreach to modify every row in that column?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2021-04-11 01:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found