From: tony summerfelt Date: 2004-06-15T06:58:41+09:00 Subject: undefine 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() { # 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. some lines are blank but i want written to the archive file for cosmetic purposes. i COULD rewrite the perl code to NOT use defined/undef (tim toadie and all that). but i don't have to. when i ported it to ruby i found the equivalent ruby code longer. maybe when i know the language a lot better it won't be and i'll find a shorter way of doing it...