#!/usr/bin/perl use strict; use utf8; binmode STDIN, ":utf8"; binmode STDOUT, ":utf8"; my $str = "See on üks täppidega lause!"; # sample string, want to get rid of spaces and exclamation mark, all other are alphas, and i really need them # first printout ( how [[:alpha:]] works) foreach my $mrk ( split(//, $str) ) { if ($mrk =~ /^[[:alpha:]]$/ ) { print "$mrk"; } } print "\n\n"; # end of first printout # second printout ( how [[:alpha:]] doesn't works) $str =~ s/[[:^alpha:]]//ig; print "$str\n"; # end of second printout exit(0); __END__ First output: Seeonükstäppidegalause Second should be also same, but is: Seeonkstppidegalause