Perl Data::Dumper output processing
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');
精彩评论