App-chars2code
view release on metacpan or search on metacpan
my $h = $o{b} ? '0x' : $o{w}? '0x' : 'u+' ; # åºç¹çªå·ãåºåããæã«è¡¨ç¤ºããæ¥é è¾
my $base = $o{0} ? 0 : 1 ; # ã¼ããªãªã¸ã³ã«ãããã1ãªãªã¸ã³ã«ããã
if ( $o{n} ) { & CountChars }
elsif ( $o{1} ) { & OneLineOneChar }
else { & LinePreserve } ;
exit 0 ;
# 1æåãå¶å¾¡æåã«ã¤ãã¦ã¯ã¨ã¹ã±ã¼ãæåãä»ããæ§ãªå½¢ã«ãããããç¨®ã®æåã®æ£è¦åããã
sub norChar($){
state $x = \{ 0,'\0',7,'\a',8,'\b',9,'\t',10,'\n',11,'\v',12,'\f',13,'\r',27,'\e'} ;
return $$x->{ ord $_[0] } // $_[0] ;
}
sub LinePreserve {
say CYAN UNDERLINE +( $o{':'} ? 'lin#:' : '' ) . '#char', DARK '(#bytes)' , RESET UNDERLINE "\tchar ", DARK "u+code .." ;
while (<>) {
my $str = decode ( $_ ) ;
print CYAN +($o{':'}?($.+$base-1).":":''), length $str , DARK '(' , length $_ , ')' , RESET "\t" ;
for ( split //, $str , 0 ) {
( run in 0.666 second using v1.01-cache-2.11-cpan-65fba6d93b7 )