in reply to Problem with Find

Updated:

According to the relevant documentation on CPAN, you need to pass the starting directory as an array. So your invocation of find() should look like this:

find (\&pstFind, ($dir) );
If you want more robust matching for a PST file, you could use the following regex statement instead of what you have:
if ( /\.PST$/i ){

Replies are listed 'Best First'.
Re^2: Problem with Find
by GrandFather (Saint) on Nov 17, 2006 at 18:16 UTC

    Actually in that context ($dir) is no different than $dir. In fact you can write find (\&wanted, $dir1, $dir2, $dir3). Remember that Perl flattens lists when passed to a sub.

    If that were the problem find would fail completely rather than finding the first few files in some directories. If find required an array (reference) rather than a list of directories then the syntax would be:

    find (\&wanted, [$dir]);

    but find complains about that with "Can't stat ARRAY(0x1e7ac3c): No such file or directory at ...".


    DWIM is Perl's answer to Gödel