Menu Home

Skipping a @perlwchallenge week, to do some #judo coding in #perl

This week, I tried to do week 75 and it just did not click. šŸ™

That said, I did do some Perl coding for someone looking at doing some research into Judo. They reached out to me as a result of my http://rwjl.net site I think. On that page I ran a research project into an alternative ranking system for Olympic Judo using the ELO system used in Chess.

So the request via email, was a great surprise. It came from someone I deeply respect; so helping was a pleasure.

Perl, has always been a tool for automating tasks. It is the superglue for many tasks. So this week I used it to automate collating some competition results into a format that suited.

Specifically… the dreaded CSV format.

But being Perl, this was easy! just two lines and it was done.

So skipping to the CSV bit, I have an array of hashes. Each entry is the result of a contest in a international Judo competition. To write this data out to a .CSV file in perl looks like this:

use Text::CSV_XS 'csv';

...

my $err = csv( in => \@data, out => "summary_data.csv" );

That’s basically it; copied directly from the POD documentation for the module (Text::CSV_XS).

This took the 167,000+ lines of data and produced a CSV with almost zero fuss. Perl rocks!

Categories: Uncategorized

Lance