Hi Wu
Welcome to Perlmonks.
This is a very helpful sites and you can certainly browse around to see what type of knowledge people have put here while trying to provide solution to the problem like yours.
Please put your code so that we can point to errors and correction and describe in little more depth if possible.