[Moscow.pm] Indirect call

Mons Anderson mons на cpan.org
Чт Дек 13 09:18:02 PST 2012


Наткнулся на весьма забавный способ сделать indirect вызов.

$ perl -Mstrict -M5.010
sub Content::headers { say "@_"; return 456 }
sub call(@) { say "call: @_" }
call( headers { "Content" => 123 } "new","arg" );

Попробуйте предсказать что будет выведено, а потом запустите )

-- 
Best wishes,
Vladimir V. Perepelitsa aka Mons Anderson
<inthrax на gmail.com>, <mons на cpan.org>
http://github.com/Mons
----------- следущая часть -----------
Вложение в формате HTML было извлечено…
URL: <http://mail.pm.org/pipermail/moscow-pm/attachments/20121213/63623a27/attachment.html>


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