DEV Community

Yuki Kimoto
Yuki Kimoto

Posted on

3

It is not widely known that Perl is one of the easiest languages to read like Python.

It is not widely known that Perl is one of the easiest languages to read like Python.

It is not widely known that Perl is one of the easiest languages to read like Python, while the information that Python is the most readable programming language is widely circulated, with no confirmation of its veracity.

To resolve this misunderstanding, let me write one code.

use v5.36;

while (my $line = <DATA>) {
  chomp $line;

  my ($id, $name, $price) = split(',', $line);

  my $new_line = join(' ', $id, $name, $price);

  say $new_line;
}

__DATA__
1,Perl,2000
2,Database,3000
3,Web,4000
Enter fullscreen mode Exit fullscreen mode

Result:

1 Perl 2000
2 Database 3000
3 Web 4000
Enter fullscreen mode Exit fullscreen mode

How readable is Perl compared to Python?

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