-1

I am coding a perl script which extracts all tables from a html webpage and then i iterate over the content.

In my code

foreach my $ts ($te->tables) {
    print "Table (", join(',', $ts->coords), "):\n";
    foreach my $row ($ts->rows) {
            print join(',', @$row), "\n";
    }}

I get the

Use of uninitialized value in join or string at

Error when there is no value in the cell of the table, for example

I dont want to surpress warnings, I think there is a more elegant way to solve this.

Thanks in Advance

Mister Lamp
  • 345
  • 1
  • 4
  • 13
  • Possible duplicate of [Perl warning: Use of uninitialized value in join or string](https://stackoverflow.com/questions/26785646/perl-warning-use-of-uninitialized-value-in-join-or-string) – Fuzzybear Jun 28 '18 at 11:30

1 Answers1

1

What output do you expect? If an empty string is OK, just replace undefs with empty strings:

for my $row ($ts->ros) {
    print join(',', map $_ // "", @$row), "\n";
}
choroba
  • 231,213
  • 25
  • 204
  • 289