It looks like you're using Internet Explorer 6. This is a very old browser which does not offer full support for modern websites. Don't miss out though! To view the site (and get a better experience from many other websites), simply upgrade to Internet Explorer 8 or download an alternative browser such as Firefox, Safari, or Google Chrome. All of these browsers are free. If you're using a PC at work, you may need to contact your IT administrator. Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser. To get the best experience, please enable JavaScript or download a modern web browser such as Internet Explorer 8, Firefox, Safari, or Google Chrome. Evaluates the BLOCK or EXPR for each element of LIST (locally setting $_ to each element) and returns the list value composed of the results of each such evaluation. In scalar context, returns the total number of elements so generated. Evaluates BLOCK or EXPR in list context, so each element of LIST may produce zero, one, or more elements in the returned value. shows that number of returned elements can differ from the number of input elements. To omit an element, return an empty list (). This could also be achieved by writing Map always returns a list, which can be assigned to a hash such that the elements become key/value pairs. See perldata for more details. Note that $_ is an alias to the list value, so it can be used to modify the elements of the LIST. While this is useful and supported, it can cause bizarre results if the elements of LIST are not variables. Using a regular foreach loop for this purpose would be clearer in most cases. See also grep for an array composed of those items of the original list for which the BLOCK or EXPR evaluates to true. If $_ is lexical in the scope where the map appears (because it has been declared with the deprecated my $_ construct), then, in addition to being locally aliased to the list elements, $_ keeps being lexical inside the block, that is, it can't be seen from the outside, avoiding any potential side-effects. { starts both hash references and blocks, so map { ... could be either the start of map BLOCK LIST or map EXPR, LIST. Because Perl doesn't look ahead for the closing } it has to take a guess at which it's dealing with based on what it finds just after the {. Usually it gets it right, but if it doesn't it won't realize something is wrong until it gets to the } and encounters the missing (or unexpected) comma. The syntax error will be reported close to the }, but you'll need to change something near the { such as using a unary + or semicolon to give Perl some help: Source.

Яндекс.Метрика Рейтинг Free Web Counter
page counter
Last Modified: April 19, 2016 @ 12:04 am