|
|
Thanks all. Just forgot these... :)
How to make a subroutie, if the caller doesn't pass an argument to it,
use $_ instead? like "print" doing.
2009/11/5 Shlomi Fish <shlomif@xxxxxxxxxxx>:
> On Thursday 05 Nov 2009 16:09:47 兰花仙子 wrote:
>> How to make a subroutine, if the caller is in scalar context, returns
>> a scalar, if the caller is in list context, returns a list.
>> Like most of Perl's built-in functions doing. Thanks.
>>
>
> See perldoc -f wantarray :
>
> http://perldoc.perl.org/functions/wantarray.html
>
> A small example based on that page:
>
|
|