开发者

Perl Data::Dumper output processing

开发者 https://www.devze.com 2023-02-10 18:00 出处:网络
I am using the DATA::Dumper api to parse an html table.. Here is the perl code: print Dumper $row; Here is the output:

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 writ开发者_开发问答ing 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.


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');
    
0

精彩评论

暂无评论...
验证码 换一张
取 消