Hey, all;
I needed to count the number of occurances of a substring within a string and
used the following method, which worked. I am just wondering if there is a
better way to do it, or (god forbid) a "best practice".
## $buffer contains an entire XML file
$buffer =~ s/(\<transfer)/$transfer_count++;$1/sg;
print "Transfer Count: $transfer_count\n";
Did I miss some obvious, and easier method?
PS: I am now reading "Higher Order Perl" by Mark Jason Dominus, and quite
enjoying it. Has anyone else used this book? Have any reviews or opinions? Just
curious.
---
Stephen ~runester~ Jarjoura
runester.com
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm