please find my test code

#!/usr/bin/perl use strict; use warnings; use Benchmark; my $t0 = Benchmark->new; #use Spreadsheet::WriteExcel; use Excel::Writer::XLSX; my $filePath = 'D:\work\test.txt'; open(FILE,"$filePath"); my $workbook = Excel::Writer::XLSX->new('tab.xls'); my $worksheet = $workbook->add_worksheet(); my $row = 0; while (my $line = <FILE>){ chomp($line); # Split on single tab #print "$line\n"; my @Fld = split('\|', $line); my $cnt = scalar(@Fld); my $col = 0; while ($cnt>= $col){ $worksheet->write_string($row, $col, $Fld[$col]); $col++; } $row++; } my $t1 = Benchmark->new; my $td = timediff($t1, $t0); print "the code took:",timestr($td),"\n";

it giving me this error --- Use of uninitialized value $str in hash element while i am using $worksheet->write_string($row, $col, $Fld[$col]);

its working fine with write subroutine $worksheet->write($row, $col, $Fld[$col]);


In reply to Re^4: convert excel cell into "Text" format with Excel:: Write::xlsx modul by sarf13
in thread convert excel cell into "Text" format with Excel:: Write::xlsx modul by sarf13

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.