From: Mark Hubbart Date: 2004-06-15T07:47:06+09:00 Subject: Re: undefine On Jun 14, 2004, at 2:58 PM, tony summerfelt wrote: > while() > { > # date parsing code was here > @diff=Delta_DHMS(@binkdate,@today) if /(\[\d+\])/; > print $trimmed $_ if $diff[0] < $ARGV[1] && defined(@diff); > next if defined(@diff); > print $trimmed $_ if ! /(\[\d+\])/; > undef(@diff); > } testing whether diff is defined won't work in ruby anyway. Any time you have an expression like this: foo = 23 if expression foo ends up being automagically defined anyway. After running that code, if expression is false, foo == nil. So, as Sean says, it would probably be better to use nil, unless Delta_DHMS might return nil itself. cheers, Mark