On Jul 7, Shobha Deepthi said:

But I want to pass another parameter to find_and_instantiate_commav_file subroutine. I tried,
   find({wanted => \&find_and_instantiate_commav_file("some_value"),
                no_chdir => 0},
                $spec_entry);

The syntax

  \&function

returns a reference to a function.  But the syntax

  \&function(...)

returns a reference to the RETURN value of function() called with whatever args you've given it. What you want to do is:

  find({
    wanted => sub { find_and_instantiate_commav_file("some_value") },
    no_chdir => 0,
  }, $spec_entry);

Here, we create an anonymous function (sub { ... }) and use it. This anonymous function, when called, just calls the find_...(...) function.

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to