Void, Scalar, and List Context
Learn about the void, scalar, and list contexts in Perl.
Amount context
Amount context governs how many items we expect an operation to produce. Think of subject-verb number agreement in English. Even without knowing the formal description of this principle, you probably understand the error in the sentence, “Perl are a fun language.” (In terms of amount context, we could say that the verb “are” expects a plural noun or noun phrase.) In Perl, the number of items we request influences how many we receive.
Suppose the find_chores()
sorts our household to-do list in order of priority. The number of chores we expect to read from our list influences what ...