in reply to Display the data passed from php

What do you mean by The contents of whole page is displayed in the browser?

Are the contents of the perl script displayed in the browser, insted of its output? If that's the case, you have a problem with the configuration of your webserver, not with perl.

And a general hint: to ease debugging of CGI scripts, start them with

#!/usr/bin/perl use warnings; use strict; use CGI::Carp qw(fatalsToBrowser);

And print the header as soon as you can.