note
DamnDirtyApe
<p>
Thank you both. I've found the relevant sections now in perlsub and in the Camel book. For the record, it was as easy as:
</p>
<code>
sub each_item (&@)
{
my $test = shift ;
foreach ( @_ ) { return 0 unless ( eval &$test ) }
return 1 ;
}
</code>
<p>
Thanks again.
</p>
<p>
<b>Update:</b> On reading [kvale]'s node a little closer, I tried changing my code to:
</p>
<code>
sub each_item (&@)
{
my $test = shift ;
foreach ( @_ ) { return 0 unless &{$test} }
return 1 ;
}
</code>
<p>
...which also worked. Is there any advantage/disadvantage to this over [eval]?
</p>
<BR/>_______________<BR/>
<FONT SIZE="-1">
<FONT COLOR="#00C090">D</FONT>
<FONT COLOR="#30F060">a</FONT>
<FONT COLOR="#60F030">m</FONT>
<FONT COLOR="#90C000">n</FONT>
<FONT COLOR="#C09000">D</FONT>
<FONT COLOR="#F06030">i</FONT>
<FONT COLOR="#F03060">r</FONT>
<FONT COLOR="#C00090">t</FONT>
<FONT COLOR="#9000C0">y</FONT>
<FONT COLOR="#6030F0">A</FONT>
<FONT COLOR="#3060F0">p</FONT>
<FONT COLOR="#0090C0">e</FONT>
<BR/>
<A HREF="/index.pl?node=DamnDirtyApe">
Home Node
</A>
|
<A HREF="mailto:DamnDirtyApe(at)MutantMail(dot)com">
Email
</A>
</FONT>
177940
177940