DEV Community

Yuki Kimoto - SPVM Author
Yuki Kimoto - SPVM Author

Posted on

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)