Perl Data::Dumper output processing

905 views Asked by At

I am using the DATA::Dumper api to parse an html table..

Here is the perl code:

print Dumper $row;

Here is the output:

$VAR1 = [
          'Info1',
          'Info2',
          'Info3',
        ];

Question: 1. I want to modify Info1, Info2, etc before writing into a SQL table. How do i access that from above output?

Something like $row->{var1}->? I've tried a couple of options and nothing worked.

1

There are 1 answers

0
vol7ron On

This is an old question, with an answer that was never selected.

Ways to update an arrayref

  • Element by array reference:

    $row->[0] = 'foo';
    $row->[1] = 'bar';
    $row->[2] = 'baz';
    
  • List assignment:

    ($row->[0], $row->[1], $row->[2]) = ('foo','bar','baz');
    
  • Array list assignment:

    @{$row} = ('foo','bar','baz');