Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[Boston.pm] Odd printing problem: msg#00038

lang.perl.perl-mongers.boston

Subject: [Boston.pm] Odd printing problem

I'm sure this is something stupid, but it is beyond me.

Let me show you the snip of code, and then I'll explain what it's supposed
to be doing:

--------------------------------------------------------------------
...
1 foreach my $framID (@$arrayName) {
2 # print out the the famID and framID.
3 print FILE $famID.",$framID";
4 foreach my $trait (@batchOfTraits) {
5 # Print the comma delimiter
6 print FILE ",";
7 # Print the residual if one exists for this trait
8 # leave blank otherwise.
9 my $traitArrayName = "fullTraitIndex_$trait";
10 my $residual = '';
11 $residual = $$traitArrayName{$framID} if
($$traitArrayName{$framID});
12 print FILE $residual if ($residual);
13 }
14 print FILE "\n";
15
16 } # end foreach member in the family
...
----------------------------------------------------------------------

I know I'm using more IF's then needed (left over code from other attempts
to make this work), so don't worry about those.
This SHOULD be creating a file that looks a bit like this:
FamID, FramID, ###,###,###,###,###,###,###,###,###,###
FamID, FramID, ###,###,###,###,###,###,###,###,###,###

Blanks when a ### doesn't exist.
Example:
...
10,4555,0.2351,-0.9367,1.8465,,-0.4863,0.04876,1.0478,-0.083,,02846
127,80453,0.9475,1.9475,-0.9576,0.4657,0.9673,-0.0365,1.0845,-0.6835,0.3865,
1.04765
...

Instead, I'm getting something that looks like this:
...
,,,,,,,,0.8288431
,,0.96724679727
,,,.0947472244
,,0.1666597.2314
10,5563,,,,,,,,,,
,,0.82328890965
,,-0.2358730.1027
,,1.4295032.910856
,,0.0867590.5631
,,0.379829-0.3758
,,-0.296481.3281
,,-0.913960.4475

...

so you see that there are a few major problems:
- The FamID and Fram ID very rarely show up
- There is rarely the full set of 10 ###'s after the FamID and FramID
- The decimal place should never go beyond 5 places, so some weird sort of
number merging is going on.

I have tested the rest of this loop and script by commenting out line 11 and
assigning $trait to $residual.
With this test, I get the exact format that I want. Everything looks great
(except all of the ###'s are replaced with the trait being examined).

Any ideas on what's going on?
Cause I'm lost.

Thanks a lot for any help.
--Alex


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe