Loading ...
Sorry, an error occurred while loading the content.

Re: Exists commadn

Expand Messages
  • kenshail2003
    ... long as the final operation is a hash or array key lookup or subroutine name: if (exists $ref- {A}- {B}- {$key}) { } ... $ref- {A}- {B}- [$ix]) { }
    Message 1 of 3 , Jan 19, 2009
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, Dhanashri Bhate
      <dhanashri_bhate@...> wrote:
      >
      > Hello,
      >
      > See these,
      > http://perldoc.perl.org/functions/exists.html
      > http://www.perl.com/doc/manual/html/pod/perlfunc/exists.html
      >
      > they both mention that, the EXPR can be arbitrarily complicated as
      long as the final operation is a hash or array key lookup or
      subroutine name: if (exists $ref->{A}->{B}->{$key}) { }
      > if (exists $hash{A}{B}{$key}) { } if (exists
      $ref->{A}->{B}->[$ix]) { }
      > if (exists $hash{A}{B}[$ix]) { } if (exists
      &{$ref->{A}{B}{$key}}) { }
      >
      >
      Define "final operation" please.
      Considering that in
      $ref->{A}->{B}->{$key}
      A itself is a key to a reference value, does exists repeatedly
      de-reference to discover if the resulting value has been defined in
      the past or not? If so that is clever and surprising.
    Your message has been successfully submitted and would be delivered to recipients shortly.