Daboo wrote:
> @comp=('111','222','333','444','555','666','777',' 888','999','000');
>
> $num=252352524577778787;
You'd better make it a string.
$num = '252352524577778787';
> #$num=18357000232333;
>
> foreach (@comp)
> {
> $numfind=$_;
> $foo = grep(!/$numfind/, $num);
Why are you using grep() to match one scalar? If you are trying to
find the number of occurrences of $numfind in $num, that's not the way
to do it. This is one way:
$foo = () = $num =~ /$numfind/g;
> print "$numfind: $foo\n";
> }
This is an alternative, shorter Perl solution:
$_ = '252352524577778787';
print 'yes! ', $1 x 3, "\n" while /(\d)\1\1/g;
--
Gunnar Hjalmarsson
Email:
http://www.gunnar.cc/cgi-bin/contact.pl