in reply to Re: Symbolic reference problem
in thread Symbolic reference problem
Yes, I know that Perl will implicitly close stuff for you, and that's fine for one-offs. BUT ... if this is going to run more than once or possibly be looked at by someone else, do things explicitly! And, it doesn't matter that something is 0.01 CPU seconds slower. CPU is cheap! Human-time is much more expensive, usually by a factor of 10,000 or more.opendir LOG_DIR, '/home/www/' or die "Cannot opendir /home/www"; while (defined(my $subdir = readdir LOG_DIR)) { open IN_FILE, '/home/www/'.$subdir.'/logs/weekly' || do {warn "Couldnt open home/www/$subdir/logs/weekly: $!"; next}; while (<IN_FILE>) { #your code } close IN_FILE; } closedir LOG_DIR;
------
/me wants to be the brightest bulb in the chandelier!
Vote paco for President!
|
|---|