DEV Community

Lance Wicks
Lance Wicks

Posted on • Originally published at lancewicks.com on

2

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" );
Enter fullscreen mode Exit fullscreen mode

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!

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay