Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
lc is a function and in your first case, you are throwing away the result of the function. This is also why Perl warns you about throwing away the result of a function . "void context" means that you don't care about the result of a function, which is uncommon when calling a function. In the second case, you are using the result of the function, by using it in the replacement part of s///. When rewriting an array, it's common to use the map function to turn each element of the (old) array into a new value:
I believe this can be written even shorter as
... but that is overly short especially if you are not yet familiar with map. Updated: Added map as example In reply to Re: Changing arrays w/ and w/o regex
by Corion
|
|