Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of uninitialized value in concatenation (.) or string 1

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Now I'm really confused, why am i getting this warning
Use of uninitialized value in concatenation (.) or string

the offending line is this
Code:
    # Build HTML
	$html = "<HTML> blah blah";

i have this above
Code:
# Set bottom link & html variables
my ($hlink, $htarget, $html);

so why the warning ?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
methinks you're looking at the wrong version of the file ...

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Usually, the ``use of uninitialised value'' warning only occurs when you've used a variable that hasn't been given a value yet. Here, the only variable you're using is an lvalue, so it shouldn't trigger that warning. Seems fishy to me.
 
i'm disappointed in you Paul, give me more credit than that.

I was so confuded over this warning that $html actually never used to be that, it was $catlist. I did a global replace because i couldn't understand why it was flaging up that line. But still the same problem.

you're right isnid very fishy, i cannot understand why i'm getting this warning.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Can you post the whole script?
Have you tried "use dianostics;"? (although I doubt it would tell you anything extra here).


Trojan.
 
morning Trojan, sure let me dig it out...

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
here you go...
Code:
#!/usr/bin/perl

######################
# Set Error Trapping # 
######################

use CGI::Carp qw(fatalsToBrowser warningsToBrowser); 
use warnings;
use strict;
# use diagnostics;

# Set path to user modules
use lib qw(path\cgi-bin\SSPL-OGR);

######################
# Use globals module #
######################
use memglobal;

##########################
# Use CheckCharts module #
##########################
use checkcharts;

# Check Charts for tunes to release
&check_charts;

##################
# Use SQL module #
##################
use sql;

# Set File DSN to use
$sql::DSN = "path/Top40.dsn";

# Read URL & Form data.
my %data = &get_data();

# Update IP Logger with WhereIs Data if REF is empty
if(!$data{'REF'}){&ip_log("SSPL / OGR Top 40 Charts");}

# Set OGR Recno
my $ogrrecno = $data{'RECNO'};

# Error correct recno
if(!$ogrrecno){$ogrrecno = 0;}

# Set bottom link & html variables
my ($hlink, $htarget, $html);

# If full listing to be displayed
if($ogrrecno <= 0 || $ogrrecno > 41){

	# Check if logged in and set colspan flag
	my $cspan;
	if(&chk_log($data{'userid'}) ne "yes"){$cspan=1;}
	else{$cspan=2}

	# Check Referer
	my $refer = &chk_refer($data{'OGR'});

    # Build HTML
	$html = "<HTML>
	<HEAD>
	<TITLE>SSPL / OGR Top 40 Charts</TITLE>
	<META NAME=\"KEYWORDS\" CONTENT=\"djs underground cds music clubbing raves rave jungle techno house hardcore garage hip hop\"> 
	<META NAME=\"DESCRIPTION\" CONTENT=\"Dedicated to underground music enthusiasts, listen to tunes, order tunes, sign/view guestbook, play games, cool links, chat room, charts and votes system, listen to our radio or post messages to our message board discussion forum, love music?, if yes, why not visit our web site !!!\">
	<link rel=\"stylesheet\" type=\"text/css\" href=\"" . URL_TO_CSS . "/sspl-ogr.css?\">
	<script type=\"text/javascript\">

	function bloc_clic1()
	{
		return false;
	}
	//-->
	</script>
	<SCRIPT language=\"JavaScript\">

	<!-- Begin
	function movepic(img_name,img_src) {
	document[img]name[/img].src=img_src;
	}
	// End -->
	
	</SCRIPT>
	<script>
	
	function refreshit() {
	
	document.charts.REF.value = 'REF';
	document.charts.submit();
	
	}
	</script>
	<script>
	function malert(num){
	if(eval('document.charts.ft' + num + '.value') == 'ogg'){alert(\"Pleae note, this file is an OGG audio file.\\n\\n You will require WinAmp or other compatible player.\");} 
	return true;
	}
	</script>
	<script>
	function checkvote(uid,ft) {
	
		answer = confirm(\"You are about to vote for\\n\\n [ \" + uid + \" - \" + ft + \" ]\\n\\n Are You Sure?\");
	
		if (answer !=\"0\"){
			window.open('" . URL_TO_CGI . "/sspl-ogr_vote.cgi?userid=' + uid,'ssplmavote','top=1,left=1,address=no,width=350,height=220'); 
			setTimeout(refreshit, 500);
		}
	}

	</script>
	<STYLE TYPE=\"text/css\"><!--BODY {margin: 0}--></STYLE>
	</HEAD>
	<BODY BGCOLOR=\"#000000\" onContextMenu=\"return bloc_clic();\" onload=\"setTimeout(refreshit, 300000);\">
	<center>
	<form name=\"charts\" action=\"" . URL_TO_CGI ."/sspl-ogr_charts.cgi\" method=\"post\">
	<input type=\"hidden\" name=\"RECNO\" value=\"$ogrrecno\">
	<input type=\"hidden\" name=\"userid\" value=\"$data{'userid'}\">
	<input type=\"hidden\" name=\"OGR\" value=\"$OGR\">
	<input type=\"hidden\" name=\"REF\" value=\"$data{'REF'}\">
	<br>
	<table cellpadding=3 border=0 cellspacing=3 class=table width=\"95%\">
	";

	# If OGR refered then display like this
	if($OGR){
		$html .= "
		<tr><td class=table colspan=$cspan><table><tr><td align=center>
		<img src=\"" . URL_TO_DOMAIN . "/images/ssplogr.jpg\" border=0 alt=\"SSPL / OGR Top 40 Charts\" Title=\"SSPL / OGR Top 40 Charts\"><br>
		<img src=\"" . URL_TO_DOMAIN . "/images/login.png\"  NAME=\"logbut\" ONCLICK=\"window.open('" . URL_TO_DOMAIN . "/login.htm','LOGIN','address=no,top=1,left=1,width=800,height=600,resizable=yes,statusbar=yes,scrollbars=yes,toolbar=yes');\" onmouseover=\"movepic('logbut','" . URL_TO_DOMAIN . "/images/login2.png');\" onmouseout=\"movepic('logbut','" . URL_TO_DOMAIN . "/images/login.png');\" style=\"cursor:pointer\" title=\"Login\">
		<img src=\"" . URL_TO_DOMAIN . "/images/signup.png\"  NAME=\"signbut\" ONCLICK=\"window.open('" . URL_TO_DOMAIN . "/signup.htm','SIGNUP','address=no,top=1,left=1,width=800,height=600,resizable=yes,scrollbars=yes,toolbar=yes');\" onmouseover=\"movepic('signbut','" . URL_TO_DOMAIN . "/images/signup2.png');\" onmouseout=\"movepic('signbut','" . URL_TO_DOMAIN . "/images/signup.png');\" style=\"cursor:pointer\" title=\"Signup\">
		<img src=\"" . URL_TO_DOMAIN . "/images/faq.png\"  NAME=\"faqbut\" ONCLICK=\"window.open('" . URL_TO_DOMAIN . "/sspl-ogr_faq.htm','FAQ','address=no,top=1,left=1,width=800,height=600,resizable=yes,scrollbars=yes');\" onmouseover=\"movepic('faqbut','" . URL_TO_DOMAIN . "/images/faq2.png');\" onmouseout=\"movepic('faqbut','" . URL_TO_DOMAIN . "/images/faq.png');\" style=\"cursor:pointer\" title=\"Frequently Asked Questions\">
		<img src=\"" . URL_TO_DOMAIN . "/images/league.png\"  NAME=\"league\" ONCLICK=\"window.open('" . URL_TO_CGI . "/sspl-ogr_league.cgi','LEAGUE','address=no,top=1,left=1,width=800,height=430,resizable=yes,statusbar=yes,scrollbars=yes,toolbar=yes');\" onmouseover=\"movepic('league','" . URL_TO_DOMAIN . "/images/league1.png');\" onmouseout=\"movepic('league','" . URL_TO_DOMAIN . "/images/league.png');\" style=\"cursor:pointer\" title=\"League Table\">
		</td><td>
		<font color=white size=3>
		Welcome to the SSPL / OGR Top 40 Charts. This is where DJ's & members can showcase their tunes to the world. Each tune is given 31 days to see how far up the charts it can go, after which the tune is automatically removed to give others a crack at the top spot. 
		<font color=#f79c19>
		"; 

		# Set link variables for bottom links
		$hlink = URL_TO_DOMAIN;
		$htarget = "_new";

	}
	#  Display if SSPL like this
	else{
		$html .= "
		<tr><td class=table colspan=$cspan><table><tr><td align=left><img src=\"" . URL_TO_DOMAIN . "/images/ssplogr.jpg\" border=0 alt=\"SSPL / OGR Top 40 Charts\" Title=\"SSPL / OGR Top 40 Charts\"></td><td>
		<font color=white size=3>
		Welcome to the SSPL / OGR Top 40 Charts. This is where DJ's & members can showcase their tunes to the world. Each tune is given 31 days to see how far up the charts it can go, after which the tune is automatically removed to give others a crack at the top spot. 
		<font color=#f79c19>
		";

		# SSPL Main CGI Script
		$hlink = URL_TO_DOMAIN . "/cgi-bin/sspl.cgi";
		$htarget = "main";

		# Display buttons according to colspan (if the are logged in don't ned buttons)

		if($cspan == 1){
		$html .= "<td class=table width=75><center>	
		<img src=\"" . URL_TO_DOMAIN . "/images/login.png\"  NAME=\"logbut\" ONCLICK=\"window.open('" . URL_TO_DOMAIN . "/login.htm','LOGIN','address=no,top=1,left=1,width=800,height=600,resizable=yes,statusbar=yes,scrollbars=yes,toolbar=yes');\" onmouseover=\"movepic('logbut','" . URL_TO_DOMAIN . "/images/login2.png');\" onmouseout=\"movepic('logbut','" . URL_TO_DOMAIN . "/images/login.png');\" style=\"cursor:pointer\" title=\"Login\">
		<img src=\"" . URL_TO_DOMAIN . "/images/signup.png\"  NAME=\"signbut\" ONCLICK=\"window.open('" . URL_TO_DOMAIN . "/signup.htm','SIGNUP','address=no,top=1,left=1,width=800,height=600,resizable=yes,scrollbars=yes,toolbar=yes');\" onmouseover=\"movepic('signbut','" . URL_TO_DOMAIN . "/images/signup2.png');\" onmouseout=\"movepic('signbut','" . URL_TO_DOMAIN . "/images/signup.png');\" style=\"cursor:pointer\" title=\"Signup\">
		<img src=\"" . URL_TO_DOMAIN . "/images/faq.png\"  NAME=\"faqbut\" ONCLICK=\"window.open('" . URL_TO_DOMAIN . "/sspl-ogr_faq.htm','FAQ','address=no,top=1,left=1,width=800,height=600,resizable=yes,scrollbars=yes');\" onmouseover=\"movepic('faqbut','" . URL_TO_DOMAIN . "/images/faq2.png');\" onmouseout=\"movepic('faqbut','" . URL_TO_DOMAIN . "/images/faq.png');\" style=\"cursor:pointer\" title=\"Frequently Asked Questions\">
		<img src=\"" . URL_TO_DOMAIN . "/images/league.png\"  NAME=\"league\" ONCLICK=\"window.open('" . URL_TO_CGI . "/sspl-ogr_league.cgi','LEAGUE','address=no,top=1,left=1,width=800,height=430,resizable=yes,statusbar=yes,scrollbars=yes,toolbar=yes');\" onmouseover=\"movepic('league','" . URL_TO_DOMAIN . "/images/league1.png');\" onmouseout=\"movepic('league','" . URL_TO_DOMAIN . "/images/league.png');\" style=\"cursor:pointer\" title=\"League Table\">
		";
		}

	}

	$html .= "</td></tr></table>
	</td></tr>
	<tr class=table align=center valign=middle><center>
	<td class=table valign=middle >
	<center><font color=#fffb7d  size=3>Click on the images to listen & vote for your favourite tune, help make a difference!</td>
	</td>
	</tr>
	<tr><td BGCOLOR=\"#000000\" ><center>
	<table border=\"0\" class=table cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">
	<tr>
	<td width=40 align=center class=table><font color=\"#FFCC66\" size=1><b>RANK / BEST</td>
	<td align=\"center\" class=\"table\"><font color=\"#FFCC66\" size=1><b>ARTIST</td>
	<td align=\"center\" class=\"table\"><font color=\"#FFCC66\" size=1><b>TITLE</td>
	<td align=center class=table><font color=\"#FFCC66\" size=1><b>STYLE</td>
	<td width=40 align=center class=table><font color=\"#FFCC66\" size=1><b>PLAYS</td>
	<td width=40 align=center class=table><font color=\"#FFCC66\" size=1><b>VOTES</td>
	<td class=table width=110 align=center><font color=\"#FFCC66\" size=1><b>PLAY / INFO / VOTE</td>
	</tr>";

	# Set Rank Counter
	my $rnk = 0;

	# Get Charts
	my @rs = &getSQL("Charts","UserID,Title,Genre,Info,Plays,Votes,Rank,Best","1=1","Votes DESC");

	# Loop chart records
	for(@rs) {
			# Add 1 to rank counter
			$rnk++;

			# Set file path and type variables 
			my $dir = DIR_TO_MP3 ."/" . $_->{'UserID'} . ".mp3"; 
			my $ufile;

			# Set if file found to MP3 else set to OGG
			if(-e "$dir"){$ufile = "mp3";}
			else{$ufile = "ogg";}

			# Build chart output
            my $javaTitle = $_->{'Title'};
            $javaTitle =~ s/'/\\'/g;

  			$html .= " <input type=\"hidden\" name=\"ft$rnk\" value=\"$ufile\"><tr class=\"table2\" onmouseover=\"style.backgroundColor='#000000';\" onmouseout=\"style.backgroundColor='#314A6B';\">
  			<td align=center title=\"$_->{'Info'}\" class=\"table2\" ><font color=#fffb7d size=2>$rnk / $_->{'Best'}</td>
  			<td align=center title=\"$_->{'Info'}\" class=\"table2\" ><font color=#fffb7d size=2>$_->{'UserID'}</td>
  			<td align=center title=\"$_->{'Info'}\" class=\"table2\" ><font color=#fffb7d size=2>$_->{'Title'}</td>
  			<td align=center title=\"$_->{'Info'}\" class=\"table2\" ><font color=#fffb7d size=2>$_->{'Genre'}</td>
  			<td align=center title=\"$_->{'Info'}\" class=\"table2\" ><font color=#fffb7d size=2>$_->{'Plays'}</td>
  			<td align=center title=\"$_->{'Info'}\" class=\"table2\" ><font color=#fffb7d size=2>$_->{'Votes'}</td>
  			<td width=110 align=center class=table ><font color=#fffb7d size=2><a href=\"" . URL_TO_MP3 . "/$_->{'UserID'}.$ufile\" border=0 title=\"Listen to the tune!\" ><img src=\"" . URL_TO_DOMAIN . "/images/speaker.gif\" width=28 height=28 border=0 alt=\"Listen to the tune!\" STYLE=\"cursor:pointer\" ONCLICK=\"malert($rnk); window.open('" . URL_TO_CGI . "/sspl-ogr_play.cgi?mp3=$_->{'UserID'}','ssplmaplay','address=no,width=5,height=5,top=1,left=1'); setTimeout(refreshit, 500);\"></a> &nbsp <img src=\"" . URL_TO_DOMAIN . "/images/info.jpg?\"  title=\"View ($_->{'UserID'}) Artist Info!\"  border=0 alt=\"View ($_->{'UserID'}) Artist Info!\" ONCLICK=\"window.open('" . URL_TO_CGI . "/sspl-ogr_info.cgi?userid=$_->{'UserID'}','ogrinfo','top=1,left=1,resizable=yes,address=no,width=450,height=560'); setTimeout(refreshit, 500); \" onmouseover=\"window.status='View ( $_->{'UserID'} ) Artist Info!';return true\" style=\"cursor:pointer\"></a> &nbsp <img src=\"" . URL_TO_DOMAIN . "/images/tick.jpg?\"  border=0 title=\"Vote for ( $_->{'UserID'} )\" alt=\"Vote for ( $_->{'UserID'} )\" ONCLICK=\"checkvote('$_->{'UserID'}','$javaTitle'); \" onmouseover=\"window.status='Vote for ( $_->{'UserID'} )';return true\" style=\"cursor:pointer\"></a></td></tr>"; 
	}

	$html .= "
	</table></td></tr><tr><td class=table colspan=2><center>
	<font color=white size=3>Charts are show in order of VOTES regardless of how many plays they have!</td></tr>
	<tr><td class=TABLE colspan=2>

	<table width=\"100%\"><tr><td ><div align=left>
	<font color=#FFCC66 size=2>(<a href = \"" . URL_TO_DOMAIN . "/cgi-bin/runpage.cgi?PG=Singles Genre&FA=" . URL_TO_DOMAIN . "/cats2.htm\" target=\"$htarget\"  style=\"cursor:pointer\" title=\"Singles Catalogue\" onmouseover=\"window.status='Singles Catalogue'; return true;\"><b>Singles</a></b>)
	</td>
	<td>
	<center><font color=#FFCC66 size=2>(<a href = \"$hlink\" target=\"$htarget\" style=\"cursor:pointer\" title=\"SSPL Home\" onmouseover=\"window.status='Home Page'; return true;\"><b>SSPL Home</a></b>)
	</td><td>
	<div align=right><font color=#FFCC66 size=2>(<a href = \"" . URL_TO_DOMAIN . "/cgi-bin/album.cgi?FA=A000\" target=\"$htarget\" style=\"cursor:pointer\" title=\"Albums Catalogue\" onmouseover=\"window.status='Albums Catalogue'; return true;\"><b>Albums</a></b>)
	 </td></tr>
	</table>
	</TD></TR>
	</table>
	<br></BODY>
	</HTML>";

}
else{
	&ip_log("SSPL / OGR Top 40 Charts");

	# Set CSS URL
	my $css = "";
	if(!$data{'CSS'}){$css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . URL_TO_CSS . "/Top40.css?\">"; $data{'OUT'}="314A6B"; $data{'OVER'}="000000";}
	else{$css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$data{'CSS'}?\">";}

	

	$html = "

	<HTML>	
	<HEAD>
	<TITLE>SSPL / OGR Top 40 Charts</TITLE>
	<META NAME=\"KEYWORDS\" CONTENT=\"djs underground cds music clubbing raves rave jungle techno house hardcore garage hip hop\"> 
	<META NAME=\"DESCRIPTION\" CONTENT=\"Dedicated to underground music enthusiasts, listen to tunes, order tunes, sign/view guestbook, play games, cool links, chat room, charts and votes system, listen to our radio or post messages to our message board discussion forum, love music?, if yes, why not visit our web site !!!\">
	
	$css

	<script type=\"text/javascript\">

	function bloc_clic1()
	{
		return false;
	}
	//-->
	</script>

	<script>

	function refreshit() {

	document.charts.submit();

	}
	</script>

	<SCRIPT language=\"JavaScript\">

	<!-- Begin
	function movepic(img_name,img_src) {
	document[img]name[/img].src=img_src;
	}
	// End -->

	</SCRIPT>
	<STYLE TYPE=\"text/css\"><!--BODY {margin: 0}--></STYLE>
	</HEAD>
	<BODY onContextMenu=\"return bloc_clic();\" onload=\"setTimeout(refreshit, 180000);\">
	<center>
	<form name=\"charts\" action=\"" . URL_TO_CGI . "/sspl-ogr_charts.cgi\" method=\"post\">
	<input type=\"hidden\" name=\"RECNO\" value=\"$ogrrecno\">
	<input type=\"hidden\" name=\"userid\" value=\"$data{'userid'}\">
	<input type=\"hidden\" name=\"OGR\" value=\"$OGR\">
	<input type=\"hidden\" name=\"CSS\" value=\"$data{'CSS'}\">
	<input type=\"hidden\" name=\"OVER\" value=\"$data{'OVER'}\">
	<input type=\"hidden\" name=\"OUT\" value=\"$data{'OUT'}\">

	</form>
	<br>";

	# Get Charts
	my @rs = &getSQL("Charts","UserID,Title,Info,Plays,Votes,Best","1=1","Votes DESC");

	# Check RECNO > No. in Charts
	if($ogrrecno > @rs){$ogrrecno = @rs;}
	
	# Continue with HTML
	$html .= "
	<table cellpadding=3 border=1 cellspacing=3 class=table width=\"95%\" valign=middle>
	<tr valign=middle><td width=\"100%\" class=\"title\" valign=\"middle\">SSPL / OGR Current Top $ogrrecno</td><td width=\"30\" valign=\"middle\"><a href=\"" . URL_TO_CGI . "/sspl-ogr_charts.cgi\" target=\"_new\" style=\"cursor:pointer\"><img src=\"" . URL_TO_DOMAIN . "/images/top40.png\"  NAME=\"top40but\" onmouseover=\"movepic('top40but','" . URL_TO_DOMAIN . "/images/top402.png');\" onmouseout=\"movepic('top40but','" . URL_TO_DOMAIN . "/images/top40.png');\" style=\"cursor:pointer\" title=\"SSPL / OGR Top 40 Charts\" border=0></a></td></tr>
	<tr><td colspan=2 class=tableband><center>
	<table border=\"0\" class=table cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">
	<tr>
	<td width=40 align=center class=tablehead>RANK / BEST</td>
	<td align=\"center\" class=\"tablehead\">ARTIST</td>
	<td align=center class=tablehead>TITLE</td>
	<td width=40 align=center class=tablehead>PLAYS</td>
	<td width=40 align=center class=tablehead>VOTES</td>
	</tr>";

	# Set Rank Counter
	my $rnk = 0;

	# Loop chart records
	for(@rs) {
		if($rnk < $ogrrecno){
			# Add 1 to rank counter
			$rnk++;
	
	  		$html .= "<tr class=\"tablerow\" onmouseover=\"style.backgroundColor='" . $data{'OVER'} . "';\" onmouseout=\"style.backgroundColor='" . $data{'OUT'} . "';\">
	  		<td align=center title=\"$_->{'Info'}\" class=\"list\" >$rnk / $_->{'Best'}</td>
	  		<td align=center title=\"$_->{'Info'}\" class=\"list\" >$_->{'UserID'}</td>
	  		<td align=center title=\"$_->{'Info'}\" class=\"list\" >$_->{'Title'}</td>
	  		<td align=center title=\"$_->{'Info'}\" class=\"list\" >$_->{'Plays'}</td>
	  		<td align=center title=\"$_->{'Info'}\" class=\"list\" >$_->{'Votes'}</td>";
		}
	}

	# finish HTML
	$html .= "

	</table></td></tr>
	</table>
	<br>
	</BODY>
	</HTML>";
}

&html_disp($html);

it is also saying the same warning for a line in my memglobal.pm module
<!-- warning: Use of uninitialized value in concatenation (.) or string at path\cgi­bin\SSPL­OGR/memglobal.pm line 453. -->
and yet look at the line..
Code:
452 # Now check for logged in user
453 if(@rs = &getSQL("Members","UserID","UserID = '$_[0]' AND logged ='yes'")){
454	# Set logged in flag
455	$islog = "yes";	
456	# Update Logged in Time
457	my $rec = &updSQL("Members","TStamp = $time","UserID = '$_[0]'");
458 }

there is not a concatination in sight ?????


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
In the string, "UserID = '$_[0]' AND logged ='yes'", there is a concatenation of three strings.

It's because internally, Perl converts that to:
"UserID = '" . $_[0] . "' AND logged ='yes'"

That would suggest to me that $_[0] is undefined but given the errors you seem to have been getting recently, I wouldn't be too sure;)
 
god your so right on the second one ish, as always you da' man!

the check charts does this
Code:
if(&chk_log($data{'userid'}) ne "yes"){$cspan=1;}
	else{$cspan=2}
and you've guessed it $data{'userid'} is null (undef) which is passed to the sub chk_log which in turn makes $_[0] = undef.

but that still doesn't explain the first warning :p

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
ok - i've changed the code like so
Code:
	# Check if logged in and set colspan flag
	my $cspan;
    if($data{'userid'}){
	    if(&chk_log($data{'userid'}) ne "yes"){$cspan=1;}
	    else{$cspan=2}
    }
    else{$cspan=2;}

    if(!$data{'OGR'}){$data{'OGR'} = "";}

	# Check Referer
	my $refer = &chk_refer($data{'OGR'});

and that has solved the other warnings, all that is left is this one about $html = "blah blah"; - this doesn't make sense, a piece of code else where must be causing it and PERL is reporting it wrong, what else could it be ?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Aha! I think I've got it - when you have a multiline quoted string, perl treats it as a single line of code, i.e. this is one line:
Code:
my $html = "<HTML><head>

</head><body>
$some_content
</body></html>";
In that code, if $some_content was empty, perl would throw the uninitialised value warning and report it as happening on the first line where the variable declaration is. You've a few variables contained in your multiline string, so it must be one of those.
 
Yup you hit the nail on the head with the first post regarding $_[0] , same thing exactly, you not feeling to good ish? , you took longer than your normal genius self to come to that conclusion.

but thanks for re-affirming what i'd deduced, i'm working on diferent code so haven't tried this yet, but found the same error in this project also and it has resolved the issue, now that I understand that PERL treats $var = "some text and a variable $anothervar"; the same as $var = "some text and a variable" . $anothervar;

Once again - than you ishnid!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top