Paul Johnson wrote:
> On Wed, Nov 25, 2009 at 02:16:51PM -0500, Steve Bertrand wrote:
>
>> Hi all,
>>
>> I just upgraded from perl 5.8 to perl 5.10.1. Everything went well,
>> except for a single module that I need.
>>
>> The offending code is this:
>>
>> ${$self->{__pb_template_list}}[...@{$self->{__PB__TEMPLATE_LIST}}}]->param(
>> $param, $value );
>>
>> As I understand it, $# has been deprecated in 5.10. Can someone please
>> help me understand the above line of code? What does $# represent in
>> this context?
>
> The variable $# is deprecated, but this isn't the usage of $# here.
> Here it is being used to get the number of elements in an array.
>
> But the original code is buggy, and whilst 5.8 let that slip, 5.10
> won't.
>
> The original code the author was trying to write should have been
>
> ${$self->{__PB_TEMPLATE_LIST}}[$#{$self->{__PB__TEMPLATE_LIST}}]->param(
> $param, $value );
>
> Notice the lack of @{}.
>
> But this is still far more complicated than it needs to be. It should
> ideally look something like
>
> $self->{__PB_TEMPLATE_LIST}->[-1]->param( $param, $value );
Ok. This worked. I thought I had tried it already, but I obviously had
the syntax wrong.
Thanks everyone! I'll be submitting the patch now.
Steve
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/