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/
|