On Monday 14 June 2004 14:58, tony summerfelt wrote:
> On Tue, 15 Jun 2004 05:31:30 +0900, you wrote:
> >What about the logic of your code or design depends on the 'existence'
> >of a variable?  What problem is it you're trying to solve with this
> >approach?
>
> just makes the code shorter. here's an excerpt of a log trimming
> program in perl (for the format that binkd generates) ('@' precedes
> arrays in perl):
>
> while(<binkd>)
> {
>     # 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);
> }
>
> this goes through each line in the log file.
> if the log line contains a date stamp, it's processed and written to
> an archive file if it meets the criteria, and the next line in the
> file is read.

Don't check for defined, check for nil.  It's virtually the same thing, unless 
there's a chance that Delta_DHMS returns nil as a real return value.

	Sean O'Dell