Learning new Perl stuff everyday... (-:
Thanks!

On Fri, Aug 12, 2011 at 11:38 PM, Gaal Yahas <[email protected]> wrote:

> Random tip: if you're using anonymous subs and want to give them names,
> too, you can use this undocumented feature:
>
> $x = sub {
>   local *__ANON__ = "o_hai";
>   print ((caller 0)[3]);
> };
> $x->();
>
> On Fri, Aug 12, 2011 at 10:04 PM, Alan Haggai Alavi <
> [email protected]> wrote:
>
>> Hello Natty,
>>
>> > I meant the current subroutine name...
>>
>> You could get the current subroutine name by using `caller` (see `perldoc
>> -f
>> caller`):
>>
>> my $sub_name = ( caller 0 )[3];
>>
>>
>> Regards,
>> Alan Haggai Alavi.
>> --
>> The difference makes the difference.
>> _______________________________________________
>> Perl mailing list
>> [email protected]
>> http://mail.perl.org.il/mailman/listinfo/perl
>>
>
>
>
> --
> Gaal Yahas <[email protected]>
> http://gaal.livejournal.com/
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to