I've taken a tip from File::Find and am doing this:

scan_mb(\&wanted, $quiz_mb);
# $quiz_mb contains a pathname to a directory

(Note this is a small task similar to the newest qotw from MJD)

I am reading a directory and foreach filename running my function &wanted. 
So, taking a tip from File::Find I am passing a reference to the wanted 
function to scan_mb. Now, inside sub scan_mb, how do I regain/use this 
passed function?

For now I'm simply cheating... (i.e. since the function lives in main, I 
simply call it and ignore the passed reference.) :-)

sub scan_mb {

   for ( <$_[1]/*> ) {
      next unless (-f $_);
      /^.*\/(.*)$/;
      wanted($_);
   }
}

Or, since both functions are in the same scope(?), perhaps passing a 
reference is pointless (other than as a good learning exercise)?

-K (Happy "Maennertag" to those in Germany)

-- 
Kevin Pfeiffer
International University Bremen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to