Schwartzian method



Hi all,

I was reading through UR coloumn by Randal in ww.stonehenge.com. I
cam across the Schwartzian method which I find extremely difficult to
understand even after the explanation given by him.Please help me
understand the concepts.

1)
@data = <>; # read data
foreach (@data) {
($name,$score) = split; # get score
$score{$_} = $score; # record it
}

I guess $_ has the instantaneous data from @data. Am I correct?

2)

@pairs = map {
($name, $score) = split;
[ $_, $score ];
} @data;
What is $_ in the ablove code?
Randal says "I build a two-element anonymous list from the
$score and the original value $_". Can somebody help me to understand
what he means?


3)
print
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [$_, (split)[1] ] }
<>;
What is $_->[0] all about?


regards,
jis

.



Relevant Pages

  • help on Schwartzian method
    ... I was reading through UR coloumn by Randal in ww.stonehenge.com. ... cam across the Schwartzian method which I find extremely difficult to ... understand even after the explanation given by him.Please help me ...
    (comp.lang.perl.modules)
  • Re: Drum Brake wont release
    ... mike wrote: 340961&machineId=9690 ... 5: CAM, RR. ... BRAKE ... The link didn't work for me, but the explanation did. ...
    (rec.motorcycles.tech)