in reply to Re: Whoops! I deleted everything!
in thread Whoops! I deleted everything!

It does. The problem is that $days is not passed into your deletion sub. This is because it is localised to package main:: (your code) but the sub is called in package File::Find where there is no var $days. As a result $days is == 0.

You were close. The fact that $days is a lexical doesn't actually make a difference. Notice that @deletions is also lexical and it doesn't cause any problems. The package that the sub is called from doesn't actually matter. The $days variable is indeed visible to the file in which the wanted sub is defined.

The real gotcha here is that $days was declared twice. Basically, the second declaration causes the first to be completely ignored. It's like that whole line is commented out. So, on the first call, which takes place to the actual initialization, $days is still undefined. On the second call, it is properly initialized.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Re: Whoops! I deleted everything!
by tachyon (Chancellor) on Dec 11, 2002 at 10:22 UTC

    Hmm, it is as you say....

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print