Re: Can explain the MAP function more clearly? Thanks



Tad McClellan <tadmc@xxxxxxxxxxxxxx> writes:
> yezi <ye_line@xxxxxxxxxxx> wrote:
>> what is {$_=> 1 } mean?
>
>
> It means the same as
>
> {$_, 1 }

Every now and then I learn something new about Perl that is so basic.
I had mentally tagged => as "quote LHS, and then act as comma"; your
comment prompted me to look up perlop, which said,

If the argument on the left is not a word, it is first
interpreted as an expression, and then the string value
of that is used.

It's always nice when I can learn something new about something I
thought I understood already.

-=Eric
.



Relevant Pages

  • Re: what is $date means?
    ... > that means the $date is current date but not a string, ... Look up what back ticks do in Perl. ... Prev by Date: ...
    (comp.lang.perl.misc)
  • java regex equiv to perl !~
    ... in perl I can say: ... I would fill $text "dynamically" from reading some kind of ... input and then test it for not having the string "def" and then do ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Re: reg expr, extract word from string
    ... >>>I need help with extracting some words from a string.. ... >>$ perl -le' ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: alphanumeric counter - howto?
    ... > AFAIK there's no built-in way for perl to convert a number to string ... > representation in base 2,8,10 or 16. ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: regexp
    ... > Earl Grieda wrote: ... >>>In the string ... No I have never used Perl, nor a lot of tcl yet. ... Prev by Date: ...
    (comp.lang.tcl)