Re: Huh? 4=3?

2013-05-09 Thread Tim Bunce
On Wed, May 08, 2013 at 10:58:02AM -0700, fe...@crowfix.com wrote: > 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

Re: Huh? 4=3?

2013-05-08 Thread Derek Jones
Hi all, > > You are right -- but this produces 4 first, as I had always thought it > would, and then 6, as I don't quite understand. I would never use > that kind of expression, and I sorta maybe understand why it says 6, > but only in hindsight. > > #!/usr/bin/perl > > my @ary = (1,2,

Re: Huh? 4=3?

2013-05-08 Thread felix
On Wed, May 08, 2013 at 06:22:09PM -0700, James Marshall wrote: > It shows 6 because a comma-separated literal list, when interpreted as a > scalar, evaluates to the final value in the list, not the length of the > list. If you evaluate "scalar(1,2,,4,,7)", it will equal 7. That's the > comma ope

Re: Huh? 4=3?

2013-05-08 Thread James Marshall
It shows 6 because a comma-separated literal list, when interpreted as a scalar, evaluates to the final value in the list, not the length of the list. If you evaluate "scalar(1,2,,4,,7)", it will equal 7. That's the comma operator at work-- even though it looks like a list (and both use commas),

Re: Huh? 4=3?

2013-05-08 Thread felix
On Wed, May 08, 2013 at 02:04:37PM -0400, Derek Jones wrote: > Huh? > > That produces 6 - as it should. What version of Perl are you working with? > On May 8, 2013, at 1:58 PM, fe...@crowfix.com wrote: > > > scalar(1,2,,4,,6) You are right -- but this produces 4 first, as I had always thought

Re: Huh? 4=3?

2013-05-08 Thread Chad Wallace
On Wed, 8 May 2013 09:30:18 -0700 Bill Ward wrote: > My guess is that get_value() is returning an empty array rather than > an undef scalar when the values are null. Try copying each one to a > scalar variable and including the list of variables in the execute(). > It'd be more readable that way

Re: Huh? 4=3?

2013-05-08 Thread Bruce Johnson
On May 8, 2013, at 10:58 AM, fe...@crowfix.com wrote: > > 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: > And I remember now the reason the error message is confusing, I'll bet t

Re: Huh? 4=3?

2013-05-08 Thread felix
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

Re: Huh? 4=3?

2013-05-08 Thread Bill Ward
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. On Wed, May 8, 2013 at 9:39 AM, Bruce Johnso

Re: Huh? 4=3?

2013-05-08 Thread Bruce Johnson
Well, changing the code to: my $eid=$mesg->entry($n)->get_value('emplId'); my $etp=$mesg->entry($n)->get_value('employeeType'); my $efte=$mesg->entry($n)->get_value('employeeFTE'); my $ear=$mesg->entry($n)->get_value('employeeTotalAnnualRate'); $csr_emp_info->execute($eid,$etp,$efte,$ear)

Re: Huh? 4=3?

2013-05-08 Thread Bill Ward
My guess is that get_value() is returning an empty array rather than an undef scalar when the values are null. Try copying each one to a scalar variable and including the list of variables in the execute(). It'd be more readable that way anyway. Or if you must put them all one one line like this, a

Huh? 4=3?

2013-05-08 Thread Bruce Johnson
Getting the error: DBD::Oracle::st execute failed: called with 3 bind variables when 4 are needed [for Statement "insert into employee_fte_annualrate_l (emplid, emptype_cd, fte, annual_rate) values(?,?,?,?)" with ParamValues: :p1='22057713', :p2='R', :p3='1', :p4='47311'] at /home/oraweb/perl/f