Your idea isn't crazy at all, it's even been done before. Too bad this isn't 1994 and you're not going to grad school at Stanford (I think), otherwise you might have made a lot of money. :)
I think that Perl is a very reasonable choice for a search engine of this kind. You'll want to look at text-encoding issues, but since you presumably speak Serbian you probably already know more about these than me.
As far as examples go, check out this Perl.com article. Don't feel tied to the underlying algorithm, but working through their example would probably be informative.