I got an uninitialized variable error the way you had it so I added the foreach bit here, & also changed the round to int(). I got your idea:
sub is_approximately_an_integer { foreach my $x ( @zeros ) { $x = shift; my $eps = 0.0001; return abs( $x-int($x) ) < $eps; } }
It seems to work ok like that. I guess next is to use the subroutine with $_ inside grep somehow?
my @wants = grep { } values %haystack;In reply to Re^4: question about what to grep(?)
by crunch_this!
in thread question about what to grep(?)
by crunch_this!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |