And the error is: Unrecognized escape \M passed through in regex; marked by <-- HERE in m/C:\Documents and Settings\pie\M <-- HERE oje dokumenty\perl\dictionary.txt/ at C:\Documents and Settings\pie\Moje dokumenty\perl\dict.pl line 10, <$filehandle> line 1. Could you help?

And the error is: Unrecognized escape \M passed through in regex; marked by <-- HERE in m/C:\Documents and Settings\pie\M <-- HERE oje dokumenty\perl\dictionary.txt/ at C:\Documents and Settings\pie\Moje dokumenty\perl\dict.pl line 10, <$filehandle> line 1. Could you help?

You need to disable the meta-characters in $filename when you do the match.