cluka has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to create a similar function called &partition that accepts a block of code and acts on an array in similar fashion. I've tried several approaches, most promising of which wasmap { ...code here... } @array
Unfortunately, this doesn't work - typing partition {...} @a just generates a syntax error.# Predeclaration sub partition($\@); ... sub partition($\@){ my ($coderef, @array) = @_; # Do something with these variables }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating operators in the flavor of map & grep...
by DamnDirtyApe (Curate) on Sep 04, 2002 at 23:55 UTC | |
|
Re: Creating operators in the flavor of map & grep...
by shotgunefx (Parson) on Sep 04, 2002 at 23:49 UTC | |
by flounder99 (Friar) on Sep 05, 2002 at 11:58 UTC | |
by shotgunefx (Parson) on Sep 05, 2002 at 13:35 UTC |