Perl variable not displaying correct value
I have a bit of code that checks an inputted value and displays default text in a textarea depending on the input value. While the value is being checked properly and setting my variable, the text in the textarea never changes.

In the code below, the logit method just outputs to a log file so I can track whats happening. The text displayed in the textarea never changes from "Lorem ipsum dolor sit amet", even though in my log file I can see that the *logit ('displayMainPage: Setting default message to concat x');* lines are running and setting the variable *$defMessage* correctly. It's just not actually showing up when I view the page.

    logit ("TESTING: $ENV{MOD_PERL}");
is outputting "*TESTING*: "

	my $defMessage = undef;
	
	logit("displayMainPage: Arguments: ".@_.": @_");
	logit ("TESTING: $ENV{MOD_PERL}");	
	if (@_ > 0) {
	$defMessage = 'Lorem ipsum dolor sit amet';
	
	if (@_ > 1) {
		$templateLength = pop @_;
		$templateType = pop @_;
		logit('displayMainPage: tLength: '.$templateLength);
		logit('displayMainPage: tTpye: '.$templateType);
		
		if ($templateLength =~ SEND_OPTIONS_CONCAT_1) {
			logit ('displayMainPage: Setting default message to concat 1');
			$defMessage = 'Lorem ipsum dolor sit amet';
		} elsif ($templateLength =~ SEND_OPTIONS_CONCAT_2) {
			logit ('displayMainPage: Setting default message to concat 2');
			$defMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
		} elsif ($templateLength =~ SEND_OPTIONS_CONCAT_3) {
			logit ('displayMainPage: Setting default message to concat 3');
			$defMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac sem est';
		}
	}
	($q) = @_;
	if ($q->param('loginUsername')) {
		$username = $q->param('loginUsername');
		do {
			$sessionKey = &generateSessionKey();
		} until (&dbIsKeyUnique($sessionKey) == 1);
		
		&dbInsertSessionKey($username, $sessionKey);
		
		$cookie = $q->cookie(
			-name=>COOKIE_CURRENT_USER,
			-value=>$username.SEP.$sessionKey,
			-path=>'/',
			-expires=>'+6h',
		);
		logit ('displayMainPage: cookie written for '.$username);
	} else {
		$cookie = $q->cookie(COOKIE_CURRENT_USER);
		my @details = split(SEP, $cookie);
		$username = @details[0];
	}
	
	print $q->header(-cookie=>$cookie);
	outputHtmlTop($q);
	
	print $q->start_form(
		-name=>'main',
		-method=>'POST',
	);
	
	logit('displayMainPage: Default Sender: '.$defSender);
	logit('displayMainPage: Default Message: '.$defMessage);
	
	print $q->h2('Welcome '.$username);
	print "Send a routed SMS<br><br>";
	
	print $q->start_table(
		{-align=>'center', -border=>1}
	);
	print $q->Tr(
		$q->td(
			{-align=>'center'},
			'Message<br>'.$q->textarea(
				-name=>'sendMessage',
				-size=>15,
				-rows=>10,
				-columns=>15,
				-value=>$defMessage,
			).
			'<br><br>Data Encoding<br>'.
			$q->popup_menu(
				-name=>'sendDcs',
				-values=>[
					SEND_DCS_0,
					SEND_DCS_1,
					SEND_DCS_2,
					SEND_DCS_4,
					SEND_DCS_5,
					SEND_DCS_6,
					SEND_DCS_7,
				],
				-default=>SEND_DCS_1,
			),
		),
Perl variable not displaying correct value
===

I have a bit of code that checks an inputted value and displays default text in a textarea depending on the input value. While the value is being checked properly and setting my variable, the text in the textarea never changes.

In the code below, the logit method just outputs to a log file so I can track whats happening. The text displayed in the textarea never changes from "Lorem ipsum dolor sit amet", even though in my log file I can see that the *logit ('displayMainPage: Setting default message to concat x');* lines are running and setting the variable *$defMessage* correctly. It's just not actually showing up when I view the page.

    logit ("TESTING: $ENV{MOD_PERL}");
is outputting "*TESTING*: "

	my $defMessage = undef;
	
	logit("displayMainPage: Arguments: ".@_.": @_");
	logit ("TESTING: $ENV{MOD_PERL}");	
	if (@_ > 0) {
	$defMessage = 'Lorem ipsum dolor sit amet';
	
	if (@_ > 1) {
		$templateLength = pop @_;
		$templateType = pop @_;
		logit('displayMainPage: tLength: '.$templateLength);
		logit('displayMainPage: tTpye: '.$templateType);
		
		if ($templateLength =~ SEND_OPTIONS_CONCAT_1) {
			logit ('displayMainPage: Setting default message to concat 1');
			$defMessage = 'Lorem ipsum dolor sit amet';
		} elsif ($templateLength =~ SEND_OPTIONS_CONCAT_2) {
			logit ('displayMainPage: Setting default message to concat 2');
			$defMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
		} elsif ($templateLength =~ SEND_OPTIONS_CONCAT_3) {
			logit ('displayMainPage: Setting default message to concat 3');
			$defMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac sem est';
		}
	}
	($q) = @_;
	if ($q->param('loginUsername')) {
		$username = $q->param('loginUsername');
		do {
			$sessionKey = &generateSessionKey();
		} until (&dbIsKeyUnique($sessionKey) == 1);
		
		&dbInsertSessionKey($username, $sessionKey);
		
		$cookie = $q->cookie(
			-name=>COOKIE_CURRENT_USER,
			-value=>$username.SEP.$sessionKey,
			-path=>'/',
			-expires=>'+6h',
		);
		logit ('displayMainPage: cookie written for '.$username);
	} else {
		$cookie = $q->cookie(COOKIE_CURRENT_USER);
		my @details = split(SEP, $cookie);
		$username = @details[0];
	}
	
	print $q->header(-cookie=>$cookie);
	outputHtmlTop($q);
	
	print $q->start_form(
		-name=>'main',
		-method=>'POST',
	);
	
	logit('displayMainPage: Default Sender: '.$defSender);
	logit('displayMainPage: Default Message: '.$defMessage);
	
	print $q->h2('Welcome '.$username);
	print "Send a routed SMS<br><br>";
	
	print $q->start_table(
		{-align=>'center', -border=>1}
	);
	print $q->Tr(
		$q->td(
			{-align=>'center'},
			'Message<br>'.$q->textarea(
				-name=>'sendMessage',
				-size=>15,
				-rows=>10,
				-columns=>15,
				-value=>$defMessage,
			).
			'<br><br>Data Encoding<br>'.
			$q->popup_menu(
				-name=>'sendDcs',
				-values=>[
					SEND_DCS_0,
					SEND_DCS_1,
					SEND_DCS_2,
					SEND_DCS_4,
					SEND_DCS_5,
					SEND_DCS_6,
					SEND_DCS_7,
				],
				-default=>SEND_DCS_1,
			),
		),