[Moscow.pm] Странности и неожиданности Perl

Andrew Shitov andy на shitov.ru
Чт Фев 28 11:00:39 PST 2008


> Удивительно то, что return не возвращает undef;
> хотя в man чётко сказано, что в Perl АБСОЛЮТНО любая функция
> возвращает какое-нибудь значение

Не совсем так:

A return statement may be used to exit a subroutine, optionally
specifying the returned value, which will be evaluated in the
appropriate context (list, scalar, or void) depending on the
context of the subroutine call. If you specify no return value,
the subroutine returns an empty list in list context, the undefined
value in scalar context, or nothing in void context.


--
Андрей Шитов
______________________________________________________________________
andy на shitov.ru | http://www.shitov.ru



Подробная информация о списке рассылки Moscow-pm