Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: undefined value as a HASH reference??

by knobunc (Pilgrim)
on May 16, 2001 at 18:23 UTC ( #80898=note: print w/replies, xml ) Need Help??

in reply to undefined value as a HASH reference??

What does the Dumper($var_ref) call that you have commented out print? Maybe I haven't had enough coffee this morning, but it looks like the results element of $var_ref is not defined.


  • Comment on Re: undefined value as a HASH reference??

Replies are listed 'Best First'.
Re: Re: undefined value as a HASH reference??
by ryddler (Monk) on May 16, 2001 at 18:33 UTC
    That's what my first thoughts were, and why I made that call in the first place, but here's what you'd see in the printout...
    $VAR1 = { 'filenumber' => '01-0052', 'results' => { 'Legal' => 'my lawyer made me do it', 'PriorpolDate' => undef, 'BldgLine' => undef, 'Deaths' => undef, 'Status' => 'OPEN', 'SearchType' => 'test', 'Notes' => 'this is where notes go…', 'Restrictions' => 'no restrictions', 'State' => 'IL', 'PIN2' => 'pin2yadayada', 'PIN3' => undef, 'City' => 'Champaign', 'LandVal' => '', 'SearchFromDate' => '2001-01-05 16:45:00', 'Drainage' => '1', 'Township' => 'village of champaign', 'EffectiveDate' => '2001-01-30 11:30:00', 'ImprovementVal' => '', 'Street' => '2408 Some Place', 'FileNumber' => '01-0052', 'Zip4' => '1234', 'Zip5' => '12345', 'OrderedBy' => undef, 'SearchedBy' => undef, 'MemberNumber' => '1234', 'Plat' => undef, 'LotSize' => 'a little bit smaller', 'Street2' => 'test street2', 'Easements' => undef, 'Exemptions' => '', 'Divorce' => undef, 'RequestDate' => '2001-01-30 11:30:00', 'MemberName' => 'W. Ghost Ryder', 'Probate' => undef, 'Wills' => undef, 'PIN' => 'assadsa', 'Access' => '100 feet of shoreline', 'TotalVal' => '' }, 'script' => '', };


      Is it possible that the Range("A6") call is returning undef? Hoewver, that does not explain why it works after you assign it to a scalar. Perhaps the thing returned by Range() is a tied hash? Can you print out the result of the following:

      my $range = $Sheet->Range("A6"); print STDERR "Ref: ", ref($range), "\n"; print STDERR "Tied: ", tied($range), "\n";


        I did you one better and added print STDERR "Range:  $range\n"; into the mix. Here's the output:
        Range: Win32::OLE=HASH(0x245b554) Ref: Win32::OLE Tied:

        Update: Further investigation shows that wrapping an eval around the hash like so:

        $Sheet->Range("A6")->{'Value'} = eval { $var_ref->{results}{'Legal'} +};
        Also executes without error.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://80898]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-04-23 06:10 GMT
Find Nodes?
    Voting Booth?