smiffy has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I'm having trouble fathoming out how to replace these two lines with a single statement, without having to create the array:
my @foo=$twig->get_xpath($my_xpath); my $bar=$foo[0]->text;
I know the following doesn't work, nor many other permutations I've tried:
my $bar=$twig->get_xpath($my_xpath)[0]->text;
Is what I am trying to do possible and, if so, what is the correct syntax?
TIA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig - trying to simplify syntax
by merlyn (Sage) on Nov 12, 2010 at 01:27 UTC | |
by smiffy (Pilgrim) on Nov 12, 2010 at 02:01 UTC | |
|
Re: XML::Twig - trying to simplify syntax
by mirod (Canon) on Nov 12, 2010 at 07:06 UTC |