#!/usr/bin/perl

use strict;
use warnings;

use Encode; 
use encoding "utf8";

my $str = "私のナマエは新納（Shinnou）です。";
foreach my $c (split('',$str)) {
    print "$c    ",char_type($c),"\n";
}

sub char_type {
    my ($c) = @_;
    if ($c =~ /\p{InHiragana}/) {
	return "Hira";
    } elsif ($c =~ /\p{InKatakana}/) {
	return "Kana";
    } elsif ($c =~ /\p{InCJKUnifiedIdeographs}/) {
	return "Kan";
    } else {
	return "etc";
    } 
}




