2

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.

Mariusz Jamro
  • 30,615
  • 24
  • 120
  • 162
Simbatish
  • 21
  • 1
  • 1
    Please read [perldoc perlreftut](http://perldoc.perlreftut.html), [perldoc perlref](http://perldoc.perlref.html) and [perldoc perldsc](http://perldoc.perlrdsc.html) - Data::Dumper is not "parsing" anything, it is just showing you the contents of your structure. – Ether Feb 13 '11 at 17:20

1 Answers1

0

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');
    
vol7ron
  • 40,809
  • 21
  • 119
  • 172