use strict; my $length = 164; my $file = 'path/to/filename.txt'; open(my $F, '<:encoding' , $file) or die "cant open $file\n$!\n"; # you will supply the right value for 'encoding'. # one common example is 'utf8' while( read( $F, my $record, $length ) ){ # do something with $record } #### my $c = 'some_scalar_data'; test_for_wide_chars: { require bytes; if ( bytes::length($c) > length($c) || ($] >= 5.008 && $c =~ /[^\0-\xFF]/)) { print "i found a wide character!" } no bytes; }