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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot track error in join command 1

Status
Not open for further replies.

1DMF

Programmer
Joined
Jan 18, 2005
Messages
8,795
Location
GB
hello,

There is something causing the following line to error...
Code:
$xls.='"'.join('","',map{$$row{$_}}@head).'"'."\n";

only all I get is
Internet Explorer cannot display the webpage

How do i work out why the join is moaning?

I use
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use warnings;
use strict;
but no matter what i do I cannot get an actual error to display to give me a hint.

Any ideas?, what info do you wan't me to post to help?


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

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
ok , don't know why but as soon as I added this..
Code:
local $| = 1;

I got
Use of uninitialized value in join or string

But why can't I join a null string?

How do I get round it?

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

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I did some testing using
Code:
        for(@head){
            if(!$row->{$_}){
                $row->{$_} = " ";
                print "ID = $row->{'Rec_ID'} , missing = $_<br><br>";
            }
        }

and it resolved it, so basically because some of the hash keys have a NULL value (well they are a recordset of a SQL DB), the join command becomes useless.

How do you tell the join to initialise any non-initialised hass key value to ' ', or is it not possible?

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

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
i've tried
Code:
       $xls.='"'.join('","',map {[b]defined() ? $row->{$_}: ''[/b]}@head).'"'."\n";
but that doesn't work.



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

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
woohoo I cracked it....

Code:
$xls.='"'.join('","',map {$row->{$_} ? $row->{$_} : ''}@head).'"'."\n";

man that gave me a headache!

[banghead]

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

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
A star for u for "crackin" it :).
 
Thank you kind sir!

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

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Worth a star for the solo effort alone!

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top