#! /usr/bin/perl -w use strict; use Encode qw(decode encode_utf8); my $infile = "sample.txt"; open(INF,$infile); while(my $line = ){ my $data = decode "UTF-8", $line; chomp($data); $data =~ tr/a-zA-ZÄÖÜäöüß0-9.,//cd; print encode_utf8 "L: $data\n"; } close(INF);