http://www.perlmonks.org?node_id=93286


in reply to Re: How do i refresh a page from the perl script.
in thread How do i refresh a page from the perl script.

With -w enabled you can't use params like that without getting uninitialized value warnings when the params aren't defined. Also $q->param{'Address'} shouldn't have curly braces but parentheses: $q->param('Address').

This version shows a way to properly initialize the variables whether the params exist or not.

#!/usr/local/bin/perl -w use strict; use CGI; my $q = CGI::new(); my $name = $q->param('Name') || ''; my $addy = $q->param('Address') || ''; print $q->header; print <<HTML; <form> Name: <input type="text" name="Name" value="$name"> Address: <input type="text" name="Address" value="$addy"> <input type="submit" value="Refresh"> </form> HTML

--
Check out my Perlmonks Related Scripts like framechat, reputer, and xNN.