some working state

fetched from perltk.de, minor modifications