#!/usr/bin/perl -l use strict; use warnings; use Encode qw/_utf8_on/; for my $str (split /:/, shift||'a:bc') { _utf8_on($str); print "$str\t", substr(lc($str), 0); # use Devel::Peek; Dump substr(lc($str),0); } #### x x yz yz #### x x yz y