Translating a Perl reference to OO PHP?

So I tripped across another oddity in translating the old developers Perl script into Object Orientated PHP, this little Perl reference statement has had me scratching my head for quite a while, but I haven't been able to figure it out via Google or friends.

I've tried my best to write out what I believe it to mean, but am uncertain if it is right. Could someone tell me if I figured it out or if I'm off? Thanks ahead of time.

The perl snippet is:


I believe it means one of the two of these in OO PHP?

!$this->state[$this->msg['hash']] //or?
$this->state != $this->msg['hash']

Am I even in the ballpark?

UPDATE I was told this is a has reference, not an array reference, but I'm uncertain since $msg->{grey}, $msg->{hash}, $msg->{domain} etc all exist in the same sub?


Actually, on a second glance, $state is a hash reference of some kind (although it could also be a blessed object of some class), and $state->{$msg->{hash}} is the value of %$state corresponding to the key $msg->{hash} (which, in turn, is the value of %$msg that corresponds to the key "hash").

So, assuming that $state and $msg are only hash references (and not specific objects), they actually correspond to arrays in PHP (one of the really dumb things about PHP is that there is no difference between an array and an associative array).

So, it would be !$state[$msg['hash']] in PHP.

Need Your Help

Exchange Web Services attachments collection is empty

c# exchange-server ews exchangewebservices

Has anyone had an issue with EWS (Exchange 2010 SP1) where the email attachments collection is empty?

CAB/SCSF Command vs Events

c# .net cab scsf

What is the difference between the Commands and the Events in CAB? There seem to do the same thing, when is the command intent to be used and the events?

updating a listfragment from an activity

android android-fragments android-cursorloader

I am trying to update my listfragment when a button is pressed. the button puts a name into a database but how do I update the list so that name appears? the listfragment uses a cursorLoader to loa...