ruby.onl / culture

Ruby Is a Better Perl (Fight Me)

2026-02-22

You've been lied to. Every Ruby tutorial starts with classes, objects, Rails scaffolding, and a mountain of ceremony that has nothing to do with getting actual work done. Here's the truth: Matz built Ruby as a better Perl. The command-line DNA is still there, hiding under years of web framework marketing. Time to dig it out.

Part 1: The Minimal Ruby Manifesto

Inspired by Tim Maher's "Minimal Perl: For UNIX and Linux People," the idea is simple. You don't need to learn all of Ruby to get real work done. Accomplish 90% of tasks with maybe 10% of the language.

Here's your entire toolkit for practical text processing:

That's it. No classes, no modules, no complexity.

Part 2: What Matz Actually Intended

Ruby was designed by Yukihiro "Matz" Matsumoto as "a better Perl" before Rails hijacked the narrative. The command-line DNA is still there:

Part 3: What to Focus On

Part 4: What to Skip (Seriously, Skip It)

You don't need any of that to parse a log file at 3 AM.

Part 5: The Minimal Ruby Way

#!/usr/bin/env ruby # Find failed SSH logins - the Minimal Ruby approach # Run like grep: ruby failed_ssh.rb /var/log/auth.log # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Track failed login attempts by IP # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ failed = Hash.new(0) # Hash with default value 0 for counting ARGF.each_line do |line| if line =~ %r~Failed password.*from\s+(\d+\.\d+\.\d+\.\d+)~ failed[$1] += 1 # $1 holds the captured IP end end # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Report sorted by count (descending) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ failed.sort_by { |ip, count| -count }.each do |ip, count| printf "%6d %s\n", count, ip end
Run it like you'd run grep: ruby failed_ssh.rb /var/log/auth.log. No gems, no Gemfile, no bundle install. Just Ruby doing what Ruby was born to do.

Created By: Wildcard Wizard. Copyright 2026