From: "Paul Malcher" <[EMAIL PROTECTED]>
If you say something like $count = grep(/$condition/,@array1); then
$count will a count of how many times the condition occurs. Now if you
a minor nit; it would be more correct to use scalar() in that case. i'm
cleaning up another person's scripts at work and one problem is an
assumption like the above could (based on the calling case) return the first
element of the array. if the call was
if ( my $count = scalar(grep(/$condition/,@array ) {
foo;
}
.. you are assured $count will always be an integer.
never ASSume.. or people like me end up cleaning scripts when someone turns
on strict. :)
-r
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs