Rewrite in perl.