| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We have now discussed all the different ways you can use variables in list and scalar context. At this point, it might be helpful to review all the ways we have used variables in different contexts. The table that follows identifies many of the ways variables are used in Perl.
Expression | Context | Variable | Evaluates to |
| scalar | | the value held in |
| list | | the list of values (in order) held in |
| scalar | | the total number of elements in |
| scalar | | the |
| scalar | | the subscript of the last element in |
| list | | a slice, listing two elements from |
| scalar (interpolated) | | a string containing the contents of |
| scalar (interpolated) | | a string containing the elements of |
| list | | a list of alternating keys and values from |
| scalar | | the element from |
| list | | a slice, listing two elements from |
This document was generated on July, 31 2004 using texi2html 1.70.