in reply to Re: Tabular Data, Group By Functions
in thread Tabular Data, Group By Functions

Hi ikegami,

Genial!
What's the meaning of '0+$_' in :
push(@data, [ map { 0+$_ } split(/\t/, $_) ]);
???
Regards,
Edward

Replies are listed 'Best First'.
Re^3: Tabular Data, Group By Functions
by mrborisguy (Hermit) on Jun 14, 2005 at 14:52 UTC

    Are you asking what $_ is? Or what the idiom 0 + $variable is?

    $_ is the current topic. It's the single item that gets passed to map every time through

    0 + $variable (where your variable is $_) takes a string that contains a number, (like "7") and changes it into an actual number, (like 7). Basically, adding 0 "numifies" the string.

        -Bryan

Re^3: Tabular Data, Group By Functions
by ikegami (Patriarch) on Jun 14, 2005 at 14:55 UTC
    Up until that point, the data exists as strings internally. That forces the data to be converted to numbers internally. I did that to pretty up the Data::Dumper output.