Thanks all. I have figured it out. I should have used `undef $/' at the beginning so that the whole file is treated as a string.
-- Zeng Nan Simple is Beautiful. ~~~~~~~~~~~~~~~~~~~~ PGP Key: http://hobbit.homeunix.org
pgpkkAaQGvqEE.pgp
Description: PGP signature