Hi All.
Shmuel Fomberg wrote:
> I'm trying to write a function:
> sub MetaField ($&) { ... }
>
> and call it like that:
> MetaField("data", { $_->ctx->{length} })
> or:
> MetaField("data", $_->ctx->{length})
>
> but only this works:
> MetaField("data", sub { $_->ctx->{length} })
I want to clarify that the call is suppose to do what the last statment
does: when MetaField runs the sub, it will return the value inside
$_->ctx->{length}. (and not that $_->ctx->{length} will contain the sub ref)
The propose of this is to make it niffy. I need to make some info
available to the function, so I thought to load it on an object, local
$_ to it, and run the function.
So why map/grep can work without sub{}, and I can't?
Shmuel.
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl