Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use utf8;
- use open qw(:std :encoding(utf8));
- use feature q(say);
- sub dq($) {
- my ($s,) = @_;
- return '"' . $s . '"';
- }
- while (<>) {
- chomp;
- s/(\p{Han}|\p{Hiragana}|\p{Katakana})(?!$)/$1:/g;
- s/(?![:])([[:ascii:]]{2})(?!$)/$1:/g;
- my @d = split /:/;
- my $d1 = dq $d[0];
- my $d2 = dq join '', @d[1..2];
- my $d3 = dq $d[3];
- my $d4 = dq join '', @d[4..6];
- say "$d1,$d2,$d3,$d4";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement