Learning Perl Objects, References amp;amp; Modules [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Learning Perl Objects, References amp;amp; Modules [Electronic resources] - نسخه متنی

Randal L. Schwartz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید














Chapter 6. Subroutine References


So far, you've seen references to arrays and hashes.
You can also take a reference to a subroutine
(sometimes called a coderef).

Why would you want to do that?
Well, in the same way that taking a reference to an array lets you
have the same code work on different arrays at different times,
taking a reference to a subroutine allows the same code to call
different subroutines at different times. Also, references permit
complex data structures. A reference to a subroutine allows a
subroutine to effectively become part of that complex data structure.

Put another way, a variable or a complex
data structure is a repository of values throughout the program. A
reference to a subroutine can be thought of as a repository of
behavior in a program. The examples in this
section show how this works.



/ 199