Click here to get back home

Help on Schwartzian method

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Help on Schwartzian method jis 06-12-2007
Posted by jis on June 12, 2007, 12:15 pm
Please log in for more thread options


Hi all,

I was reading through UR coloumns by Randal in www.stonehenge.com. I
came across the code which i really tried heating up my brain ..but
with no result. Can anyone help me understand how the concept goes.

(1)

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

I guess $_ contains what is read from @data at a given time in
the loop.Am I correct?

(2)
But what is $_ in

@pairs = map {
($name, $score) = split;
[ $_, $score ];
} @data;

Randal says" I build a two-element anonymous list from the $score and
the original value $_"

what does that mean?

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

Now I dont even have any clue on what is $_->[0],$a->[1] and $b-
>[1]


Please help me with answers.

regards,
jis


Similar ThreadsPosted
help on Schwartzian method June 12, 2007, 12:29 pm
Schwartzian method June 12, 2007, 12:30 pm
Which Net::FTP method for this?" November 7, 2005, 1:36 pm
get method. February 24, 2007, 7:18 am
Is a hash the best method to do this? December 24, 2007, 1:23 pm
Is there any method/way to use API(Windows or Linux) November 30, 2006, 7:26 am
field method for Win32::IE::Mechanize December 15, 2004, 5:39 pm
Credentials and POST method with IO::Socket::SSL? June 30, 2006, 5:14 pm
Can't locate object method "ymd" via package... August 3, 2007, 6:14 am
Pg.pm Question - Can't locate object method driver October 31, 2004, 9:17 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap