in reply to XML::Twig oddity
but it saysuse strict; use warnings; use XML::Twig; my $xml = <<XML <foo> <bar> <bay V="A" /> <baz V="B" /> </bar> </foo> XML my $t = XML::Twig->new ( twig_handlers => { '/foo/bar' => sub { my $bay = $_->first_child('bay'); my $baz = $_->first_child('baz'); print $bay->att("V"); print $baz->att("V"); } } ); $t->parse ($xml);
what am I doing wrong?./xml_test1.pl syntax error at ./xml_test1.pl line 17, near "my " Global symbol "$t" requires explicit package name at ./xml_test1.pl li +ne 17. Can't use global $_ in "my" at ./xml_test1.pl line 21, near "= $_" syntax error at ./xml_test1.pl line 26, near "}" Execution of ./xml_test1.pl aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig oddity
by Anonymous Monk on Nov 15, 2008 at 07:10 UTC | |
|
Re^2: XML::Twig oddity
by convenientstore (Pilgrim) on Nov 15, 2008 at 07:34 UTC | |
by Anonymous Monk on Nov 15, 2008 at 08:23 UTC | |
by convenientstore (Pilgrim) on Nov 15, 2008 at 20:48 UTC |