Re: Huh? 4=3?

[email protected]
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On Wed, May 08, 2013 at 09:43:27AM -0700, Bill Ward wrote:
> Cool. That whole scalar vs list context thing is one of Perl's biggest
> strengths, but also one of its biggest weaknesses (in that it is a common
> source of bugs like this). When you see head-scratching problems, it's one
> of the first things to look for.

Just guessing here, not familiar with the particular code in question.
But I have been bitten a few times by code which returns false in the
'proper' manner

    return;

instead of forcing a scalar return

    return undef;

or list return

    return ();

Is that what's going on here -- the original code imparted a list
context, which triggered another perl gotcha, whereby missing list
values simply disappear:

    scalar(1,2,,4,,6) ---> 4, not 6

I understand and appreciate most of Perl's little tricks, but they
sometimes catch me by surprise and elicit a few curses while debugging.

-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
     Felix Finch: scarecrow repairman & rocket surgeon / [email protected]
  GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.