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

evaulation in one line

Expand Messages
  • Noah
    Hi there, is there anyway to put this evaulation on one line? next if ($community{$community_number}{$community_name} != ) && ( $community_subname eq
    Message 1 of 2 , Sep 2, 2006
    • 0 Attachment
      Hi there,

      is there anyway to put this evaulation on one line?


      next if ($community{$community_number}{$community_name}
      != "") && ( $community_subname eq $loop_subname );
      next if ($community{$community_number}{$community_name}
      != "");

      I was thinking

      next if ($community{$community_number}{$community_name}
      != "") || (($community{$community_number}{$community_name} != "") && (
      $community_subname eq $loop_subname ));

      is there any other way to do this?

      Cheers,

      Noah





      [Non-text portions of this message have been removed]
    • merlyn@stonehenge.com
      ... Noah Hi there, Noah is there anyway to put this evaulation on one line? Noah next if ($community{$community_number}{$community_name}
      Message 2 of 2 , Sep 3, 2006
      • 0 Attachment
        >>>>> "Noah" == Noah <admin2@...> writes:

        Noah> Hi there,
        Noah> is there anyway to put this evaulation on one line?


        Noah> next if ($community{$community_number}{$community_name}
        Noah> != "") && ( $community_subname eq $loop_subname );
        Noah> next if ($community{$community_number}{$community_name}
        Noah> != "");

        Noah> I was thinking

        Noah> next if ($community{$community_number}{$community_name}
        Noah> != "") || (($community{$community_number}{$community_name} != "") && (
        Noah> $community_subname eq $loop_subname ));

        Noah> is there any other way to do this?

        I'd start with:

        my $some_meaningful_name = $community{$community_number}{$community_name};

        before you get to that expressions. First, it'll be faster to do that lookup
        only once. Second, it'll be a LOT easier on the reader's eyes.

        Third, the code != "" doesn't make sense to me. A numeric comparison
        to a string? What are you really trying to say?



        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      Your message has been successfully submitted and would be delivered to recipients shortly.