DEV Community

Yuki Kimoto - SPVM Author
Yuki Kimoto - SPVM Author

Posted on

Perl is enough easy to learn

I saw often the misleading information "Perl is difficult to learn".

Personally I feel Perl is enough easy to learn.

I write a program.

Input

kimoto,19,Japan
Ken,23,US
Pony,29,UK

Output

kimoto-19-Japan
Ken-23-US
Pony-29-UK

Program

use strict;
use warnings;

while (my $line = <DATA>) {
  chomp $line;
  my @items = split(/,/, $line);
  print join('-', @items) . "\n";
}

__DATA__
kimoto,19,Japan
Ken,23,US
Pony,29,UK
Enter fullscreen mode Exit fullscreen mode

Let's play this program on PerlBanjo.com

Top comments (0)