Perl vs Ruby

Need advice about which tool to choose?Ask the StackShare community!

Perl

4.3K
926
+ 1
574
Ruby

45K
21.2K
+ 1
4K
Add tool

Perl vs Ruby: What are the differences?

Introduction

This Markdown code provides a concise comparison between Perl and Ruby. Highlighting the key differences between these two programming languages will help to better understand their unique features and functionalities.

  1. Syntax: One significant difference between Perl and Ruby is their syntax. Perl has a more complex and flexible syntax, allowing for different ways to achieve the same result. On the other hand, Ruby has a cleaner and more consistent syntax, which makes it easier to read and understand code.

  2. Object-Oriented Programming: While both Perl and Ruby support object-oriented programming (OOP), Ruby is exclusively object-oriented, whereas Perl is a procedural language with some OOP capabilities. Ruby has built-in support for classes, inheritance, and other OOP concepts, making it more suitable for developing complex software systems.

  3. Regular Expressions: Perl is well-known for its extensive support for regular expressions. It provides a robust regular expression engine and offers a wide range of regex-related features that are not as comprehensive in Ruby. Ruby also supports regular expressions but with a slightly different syntax and fewer advanced features compared to Perl.

  4. Community and Libraries: Ruby has a vibrant and active community of developers, which has resulted in a rich ecosystem of libraries and frameworks. It provides extensive support for web development, scripting, and various other domains. Perl also has a strong community but has seen a decline in popularity in recent years, resulting in a smaller library collection compared to Ruby.

  5. Elegance and Readability: Ruby emphasizes the principle of "beautiful code" and aims for an elegant and readable syntax. It prioritizes simplicity and clear expression, making Ruby code more intuitive and easier to understand. Perl, on the other hand, allows for more concise but potentially cryptic code, which may be harder to read and maintain for developers unfamiliar with the language.

  6. Development Philosophy: Ruby follows the principle of "Convention over Configuration," promoting the use of naming conventions and established patterns to simplify development and reduce the need for explicit configuration. Perl, however, offers a more flexible and customizable approach, allowing developers to have greater control over configurations and implementation details.

In summary, Perl and Ruby have notable differences in their syntax, object-oriented capabilities, regular expression support, community and libraries, code elegance and readability, and development philosophy. Understanding these distinctions can guide developers in choosing the most suitable language for their specific needs.

Advice on Perl and Ruby
Caue Carvalho
Needs advice
on
GolangGolangPythonPython
and
RubyRuby

Hello!

I'm a developer for over 9 years, and most of this time I've been working with C# and it is paying my bills until nowadays. But I'm seeking to learn other languages and expand the possibilities for the next years.

Now the question... I know Ruby is far from dead but is it still worth investing time in learning it? Or would be better to take Python, Golang, or even Rust? Or maybe another language.

Thanks in advance.

See more
Replies (8)
Angel Ramirez
Recommends
on
GolangGolangPythonPython
at

Hi Caue, I don't think any language is dead in 2022, and we still see a lot of Cobol and Fortran out there, so Ruby is not going to die for sure. However, based on the market, you'll be better off learning Goland and Python. For example, for data science, machine learning, and similar areas, Python is the default language while backend API, services, and other general purpose Goland is becoming the preferred.

I hope this helps.

See more
Recommends
on
GolangGolangPythonPython

I feel most productive using go. It has all the features I need and doesn't throw road blocks in your way as you learn. Rust is the most difficult to learn as borrow checking and other features can puzzle a newcomer for days. Python is a logical next step as it has a huge following, many great libraries, and one can find a gig using python in a heartbeat. Ruby isn't awful, it's just not that popular as the others.

Another reason to use python is that it is not compiled. You can muck around in the interpreter until you figure things out. OTOH, that makes it less performant. You really need to think about your use cases, your interest in lower-lever versus high-level coding, and so on.

See more
Roman Glushko
Machine Learning, Software Engineering and Life · | 4 upvotes · 58.1K views
Recommends
on
GolangGolangPythonPythonRustRust

I enjoy coding in Python. I think it's minimalistic and readable syntax and lang features are just unparalleled. They are perfect for prototyping and for the software engineering in general. If I'm not wrong Gitlab marked Python as #2 popular language after JavaScript. Beyond that, Python ecosystem and areas of usage are enormous. In areas like ML/DL, it's important to know Python to leverage variety of existing tools and frameworks.

Then, I have learned and worked with Golang. I use it where I think I would need a slightly better performance than in Python. Plus, relatively small and self-contained executable is a great thing to have. If you plan to write distributed systems, extend Kubernetes or do similar things I think Golang is a great choice. It's also simple and straightforward, especially when you want to do effective multithreading. Although I don't like that Golang is more low-level than Python. Sometimes I feel like I need to implement myself too much things.

Now, about Rust. It's my second try to learn Rust. First time I decided to learn Golang as I understood it in 30mins or so while I was struggling to compile/do anything meaningful there for quite a bit. So I personally don't think Rust is super easy. I have got back to learning Rust as it's going to fill one of gaps in my problem solving toolkit - let me write low-level system programs (e.g. linux kernel modules). I don't want to learn "obsolete" C/C++ (my reasons are similar to why Google has recently introduced Carbon - a replacement for C/C++ codebases). If you are not going to tight your life with system-like programming, Rust may be an overkill for you.

Finally, I have never coded in Ruby, so are not going to comment it.

See more
Recommends

I'm almost same position as you. 8 years same company with c#. I tried both Python and Golang. I like working with Golang. Check this litte go doc. After reading this document and following its examples, I decided to work with "go" https://www.openmymind.net/assets/go/go.pdf

See more
Recommends
at

Since you are very experienced, picking up a language will not take you more than a week. Rust is a very new language. Many startups are still experimenting with it. Golang is very popular nowadays. You can see a lot of golang jobs in the market. The best part is, compiled code is single binary and has a minimal footprint. Rails is a compelling framework; believe me, many websites like Shopify, GitHub, GitLab, etc., are powered by the rails framework. You can also leverage the power of metaprogramming in Ruby. Python is memory and CPU intensive. It is not as performant as the other three. If you want to go into Data Science, Python is the language. Good luck, buddy. Feel free to connect with me: https://twitter.com/avirajkhare00

See more
Recommends
on
PythonPython

Because it opens endless possibilities you can do anything and everything you want to. from ai to app development to web development.

See more
Recommends
on
GolangGolangPythonPythonRubyRuby

it is highly recommended to take a look at that survey

https://survey.stackoverflow.co/2022/

See more
A Nielsen
Fullstack Dev at ADTELA · | 1 upvotes · 54.7K views
Recommends
on
GolangGolangPythonPython

Either Python or Golang, for all the enlightened reasons already mentionned in all advices/comments :) Enjoy!

See more
Needs advice
on
GolangGolangPerlPerl
and
RustRust

I intend to use a programming language which I'll use as AWS runtime and write a script that will comb through tons of files in a directory and its subdirectories and search for simple text regular expressions and process and write the matches in a file as output. I have heard that Perl is good for regex based search but I also want the performance to be good as it will have to go through tons of files for IO. In this post: https://filia-aleks.medium.com/aws-lambda-battle-2021-performance-comparison-for-all-languages-c1b441005fd1, I see that Rust works well as AWS Lambda runtime with very good performance. Which one should I choose as my AWS lambda runtime for this problem? Golang is also an option as it is fast as per the above link.

See more
Replies (1)
Recommends

I used to work in a Perl shop and must admit that the language is very simple for tasks like these, but as you mentioned it's not fast at execution time. I'm now a Go programmer professionally but I taught myself the language while in college purely out of interest and eventually found my way to the job, not the other way around. I've recently been learning a little rust because of how much that language comes up in conversations around Go. I find the concept of the borrow checker nice but I have to admit I feel lost like I am in most flavors of new fancy framework js. That's not to say Rust is really anything like js, but the learning appears the same to me as someone who's convinced they could learn just about any programming language if it was necessary (over time I've seen procedural, OOP, declarative and functional stuff but never programming logic outside of the prolog code I wrote in school).

Go isn't made for your specific task at hand but it's a very easy language to pick up and it has good directory traversal standard library code and good regex (even though with time perl's has been optimized to be faster and I think it's written in C++) but more than anything Go is "cloud native" programming in that an awful lot of new microservice tech stacks are centered around it, docker and kubernetes are written in it, and there's a thriving community whose focus is generally web-first and performance-oriented. This means for your use case there might already be a large cohort of gophers that have asked the stackoverflow questions for you

I personally would push you towards the NYT Profiler for Perl before I would towards Rest, but that's because I know you wouldn't waste any time being able to get to the task at hand and then make it go faster, and I expect all but a few rustaceans would be able to do so with the same speed.

Whatever you pick I wish you the very best of luck!

See more
Decisions about Perl and Ruby
Mark Esser
Team Lead Talent Acquisition at i22 Digitalagentur GmbH · | 8 upvotes · 100.9K views

A developer and project manager from our team X says the following about our use of Rails at i22:

"We use Rails to build stable and flexible backend systems. Rails is extremely good for managing data structures and quickly setting up new systems. It is the perfect base for most use cases."

I asked the same Team X member why the team prefers to work with Ruby on Rails, rather than Python and Django:

"Because Python is a scripting language and from my point of view not suitable for building stable web services. Python is for me rather good for scripts and fast small tools. Not for stable business applications. And if I want it fast I prefer Go."

See more
Ing. Alvaro RodrĂ­guez Scelza
Software Systems Engineer at Ripio · | 12 upvotes · 353.9K views

I was considering focusing on learning RoR and looking for a work that uses those techs.

After some investigation, I decided to stay with C# .NET:

  • It is more requested on job positions (7 to 1 in my personal searches average).

  • It's been around for longer.

  • it has better documentation and community.

  • One of Ruby advantages (its amazing community gems, that allows to quickly build parts of your systems by merely putting together third party components) gets quite complicated to use and maintain in huge applications, where building and reusing your own components may become a better approach.

  • Rail's front end support is starting to waver.

  • C# .NET code is far easier to understand, debug and maintain. Although certainly not easier to learn from scratch.

  • Though Rails has an excellent programming speed, C# tends to get the upper hand in long term projects.

I would avise to stick to rails when building small projects, and switching to C# for more long term ones.

Opinions are welcome!

See more
Timm Stelzer
VP Of Engineering at Flexperto GmbH · | 18 upvotes · 601.1K views

We have a lot of experience in JavaScript, writing our services in NodeJS allows developers to transition to the back end without any friction, without having to learn a new language. There is also the option to write services in TypeScript, which adds an expressive type layer. The semi-shared ecosystem between front and back end is nice as well, though specifically NodeJS libraries sometimes suffer in quality, compared to other major languages.

As for why we didn't pick the other languages, most of it comes down to "personal preference" and historically grown code bases, but let's do some post-hoc deduction:

Go is a practical choice, reasonably easy to learn, but until we find performance issues with our NodeJS stack, there is simply no reason to switch. The benefits of using NodeJS so far outweigh those of picking Go. This might change in the future.

PHP is a language we're still using in big parts of our system, and are still sometimes writing new code in. Modern PHP has fixed some of its issues, and probably has the fastest development cycle time, but it suffers around modelling complex asynchronous tasks, and (on a personal note) lack of support for writing in a functional style.

We don't use Python, Elixir or Ruby, mostly because of personal preference and for historic reasons.

Rust, though I personally love and use it in my projects, would require us to specifically hire for that, as the learning curve is quite steep. Its web ecosystem is OK by now (see https://www.arewewebyet.org/), but in my opinion, it is still no where near that of the other web languages. In other words, we are not willing to pay the price for playing this innovation card.

Haskell, as with Rust, I personally adore, but is simply too esoteric for us. There are problem domains where it shines, ours is not one of them.

See more
Andrew Carpenter
Chief Software Architect at Xelex Digital, LLC · | 16 upvotes · 399.1K views

In 2015 as Xelex Digital was paving a new technology path, moving from ASP.NET web services and web applications, we knew that we wanted to move to a more modular decoupled base of applications centered around REST APIs.

To that end we spent several months studying API design patterns and decided to use our own adaptation of CRUD, specifically a SCRUD pattern that elevates query params to a more central role via the Search action.

Once we nailed down the API design pattern it was time to decide what language(s) our new APIs would be built upon. Our team has always been driven by the right tool for the job rather than what we know best. That said, in balancing practicality we chose to focus on 3 options that our team had deep experience with and knew the pros and cons of.

For us it came down to C#, JavaScript, and Ruby. At the time we owned our infrastructure, racks in cages, that were all loaded with Windows. We were also at a point that we were using that infrastructure to it's fullest and could not afford additional servers running Linux. That's a long way of saying we decided against Ruby as it doesn't play nice on Windows.

That left us with two options. We went a very unconventional route for deciding between the two. We built MVP APIs on both. The interfaces were identical and interchangeable. What we found was easily quantifiable differences.

We were able to iterate on our Node based APIs much more rapidly than we were our C# APIs. For us this was owed to the community coupled with the extremely dynamic nature of JS. There were tradeoffs we considered, latency was (acceptably) higher on requests to our Node APIs. No strong types to protect us from ourselves, but we've rarely found that to be an issue.

As such we decided to commit resources to our Node APIs and push it out as the core brain of our new system. We haven't looked back since. It has consistently met our needs, scaling with us, getting better with time as continually pour into and expand our capabilities.

See more
Thomas Miller
Talent Co-Ordinator at Tessian · | 16 upvotes · 226.7K views

In December we successfully flipped around half a billion monthly API requests from our Ruby on Rails application to some new Python 3 applications. Our Head of Engineering has written a great article as to why we decided to transition from Ruby on Rails to Python 3! Read more about it in the link below.

See more
Mike Fiedler
Enterprise Architect at Warby Parker · | 3 upvotes · 217.9K views

When I was evaluating languages to write this app in, I considered either Python or JavaScript at the time. I find Ruby very pleasant to read and write, and the Ruby community has built out a wide variety of test tools and approaches, helping e deliver better software faster. Along with Rails, and the Ruby-first Heroku support, this was an easy decision.

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Perl
Pros of Ruby
  • 72
    Lots of libraries
  • 66
    Open source
  • 61
    Text processing
  • 54
    Powerful
  • 49
    Unix-style
  • 47
    Regex
  • 37
    Stable
  • 32
    Concise syntax
  • 29
    Hackerish
  • 22
    Easy to use
  • 15
    Swiss army chainsaw
  • 13
    Code Less Do More
  • 12
    CPAN
  • 9
    Freedom
  • 8
    All purpose
  • 5
    Many ways to do it
  • 5
    Familiar
  • 5
    Readability
  • 5
    Community
  • 4
    Modular
  • 4
    Smart (does alot for you)
  • 4
    Object-Oriented
  • 3
    Postmodern
  • 3
    It's the best one-off task language
  • 2
    For a man
  • 2
    Good man pages
  • 1
    Auto case variables
  • 1
    Single Source Library (CPAN)
  • 1
    Multi-threaded support
  • 1
    Hashes
  • 1
    C-style
  • 1
    Multiparadigm
  • 605
    Programme friendly
  • 536
    Quick to develop
  • 490
    Great community
  • 468
    Productivity
  • 432
    Simplicity
  • 273
    Open source
  • 234
    Meta-programming
  • 207
    Powerful
  • 156
    Blocks
  • 139
    Powerful one-liners
  • 69
    Flexible
  • 58
    Easy to learn
  • 51
    Easy to start
  • 42
    Maintainability
  • 37
    Lambdas
  • 30
    Procs
  • 21
    Fun to write
  • 19
    Diverse web frameworks
  • 13
    Reads like English
  • 10
    Makes me smarter and happier
  • 9
    Rails
  • 8
    Very Dynamic
  • 8
    Elegant syntax
  • 6
    Matz
  • 5
    Object Oriented
  • 5
    Programmer happiness
  • 4
    Elegant code
  • 4
    Generally fun but makes you wanna cry sometimes
  • 4
    Friendly
  • 4
    Fun and useful
  • 3
    Easy packaging and modules
  • 3
    There are so many ways to make it do what you want
  • 2
    Primitive types can be tampered with

Sign up to add or upvote prosMake informed product decisions

Cons of Perl
Cons of Ruby
  • 4
    Messy $/@/% syntax
  • 3
    No exception handling
  • 2
    Bad OO support
  • 2
    "1;"
  • 2
    No OS threads
  • 1
    Variables are global by default
  • 1
    Copy-on-create for interpreter-based threads
  • 1
    Barewords
  • 1
    Errors/warnings are ignored by default
  • 7
    Memory hog
  • 7
    Really slow if you're not really careful
  • 3
    Nested Blocks can make code unreadable
  • 2
    Encouraging imperative programming
  • 1
    Ambiguous Syntax, such as function parentheses

Sign up to add or upvote consMake informed product decisions

What is Perl?

Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more.

What is Ruby?

Ruby is a language of careful balance. Its creator, Yukihiro “Matz” Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.

Need advice about which tool to choose?Ask the StackShare community!

What companies use Perl?
What companies use Ruby?
See which teams inside your own company are using Perl or Ruby.
Sign up for StackShare EnterpriseLearn More

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with Perl?
What tools integrate with Ruby?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

Nov 20 2019 at 3:38AM

OneSignal

PostgreSQLRedisRuby+8
9
4627
Oct 24 2019 at 7:43PM

AppSignal

JavaScriptNode.jsJava+8
5
948
Jun 6 2019 at 5:11PM

AppSignal

RedisRubyKafka+9
15
1634
GitHubDockerReact+17
40
36161
What are some alternatives to Perl and Ruby?
PHP
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
C lang
Java
Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!
Python
Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.
PowerShell
A command-line shell and scripting language built on .NET. Helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.
See all alternatives