In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote
> On Sep 10, Stephen said:
>
> >> find( {
> >> wanted => \&wanted,
> >> preprocess = \&preprocess,
> >> postprocess = \&postprocess,
> >> }, 'C:/SomeFolder');
> >
> >Starting to make sense. Just a small question, though. The use of \&
> >before the sub name -- my understanding is that the "\" character is
> >used as an escape, the "&" character defines a sub (but is regularly
> >omitted), and the format for calling a sub is "sub_name ()" rather than
> >"&sub_name ()". If that's correct, why is "\&" being used in the hash?
>
> Outside of strings, \ is used to take a reference to something. We don't
> want to CALL the wanted(), preprocess(), and postprocess() functions when
> building the hash, we just want the values in the hash to be the places to
> FIND the functions to call. The find() function expects references to
> functions, so it can call them later.
>
> sub foo { print "Hi, $_[0]!\n" }
> my $ref_to_foo = \&foo;
> $ref_to_foo->("Jeff");
>
>
>From the It Seems Obvious When You Put it Like That Category: I get it!
Thanks for the clarification.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]