in reply to Re: Guest Cleanup
in thread Guest Cleanup

$elem is a lousy variable name, just as bad as $count. Also note that mkpath throws exceptions on some errors; when switching to it instead of mkdir, consider whether or not you want to catch them with eval { }.

Replies are listed 'Best First'.
Re^3: Guest Cleanup
by jdporter (Paladin) on Oct 02, 2006 at 13:28 UTC
    $elem is a lousy variable name, just as bad as $count.

    I respectfully disagree. It's bad, but not as bad. $elem carries very little information; $count is actually misleading.

    In such situations, I tend to use $_, which has the advantage of being known, a priori, as a list iterator, by virtue of its special relation to foreach and while(<>).

    for ( "$year:$mon:$mday", "$hour:$min:$sec" ) { mkdir $_ or die "mkdir $_ - $!"; chdir $_ or die "chdir $_ - $!"; }
    We're building the house of the future together.