ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-unix-users
perl-unix-users
Re: [Perl-unix-users] Perl questions &&
by $Bill Luebkert other posts by this author
Apr 8 2003 6:35PM messages near this date
Re: [Perl-unix-users] perl and microsoft word | RE: [Perl-unix-users] Perl questions &&
haze_hutmacher@[...].com wrote:
>  I am tasked with editing a piece of code written some years ago by people long gone. Of co
urse the code is undocumented and I am not an expert programmer. The question:
>  
>  if ( $val[$i]{'numeric'} && $val[$i]{'numeric'}< 3) {
>  	return 0}
>     }
>  
>  It looks to me like we are logically AND-ing the exact same values from a hash table. If t
he value is less than 3 return 0. However, if you logically AND two exact same values don't 
you always get the original value? Does the following give the same result?
>  
>  if ( $val[$i]{'numeric'}< 3) {
>  	return 0}
>     }
>  
>  I have written a test snippet and the results of each are the same. The real question is; 
"Is this 'genius' code and I am an idiot or is the original author being obtuse?" 
>  
>  This is driving me crazy and I am low on medication so your help is appretiated [:-}

In addition to handling the 0 case as previously mentioned,
this code will also handle the case where $val[$i]{numeric}
doesn't exist in the hash.

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
 (_/   /  )    // //       DBE Collectibles   Mailto:dbe@[...].com
  / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved