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); > > Here you check that @diff is defined after trying to access an element of diff, is that right? > next if defined(@diff); > print $trimmed $_ if ! /(\[\d+\])/; > undef(@diff); >} > > > How about this (untested)? while(binkd) # date parsing code was here diff=Delta_DHMS(binkdate, today) if /(\[\d+\])/ print $trimmed $_ if diff && diff[0] < ARGV[1] next if diff print $trimmed $_ if ! /(\[\d\])/ diff = nill end -- Mark Sparshatt