in reply to Re: Creating operators in the flavor of map & grep...
in thread Creating operators in the flavor of map & grep...
See this thread about prototypes and especially Tom Christiansen's Prototypes in Perl for a very in-depth discussion of prototypes.use strict; use Data::Dumper; sub takes_coderef (&@); takes_coderef {print "I'm a code ref called with (", join(", ", @_), " +)\n"} "first", 2, 3; sub takes_coderef (&@) { my $coderef = shift; my @otherargs = @_; &$coderef(@otherargs); print Data::Dumper->Dump([\@otherargs], ["*otherargs"]); } ___OUTPUT___ I'm a code ref called with (first, 2, 3) @otherargs = ( 'first', 2, 3 );
--
flounder
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Creating operators in the flavor of map & grep...
by shotgunefx (Parson) on Sep 05, 2002 at 13:35 UTC |