--snip-- Benchmark: timing 300 iterations of c_strncmp, c_strncmp_M, c_strstr, c_strstr_M, m_array, m_array_M, m_for, m_for_M, m_while, m_while_M, tr... c_strncmp: 7 wallclock secs ( 7.44 usr + 0.00 sys = 7.44 CPU) c_strncmp_M: 8 wallclock secs ( 7.31 usr + 0.00 sys = 7.31 CPU) c_strstr: 1 wallclock secs ( 1.36 usr + 0.00 sys = 1.36 CPU) c_strstr_M: 1 wallclock secs ( 1.18 usr + 0.00 sys = 1.18 CPU) m_array: 14 wallclock secs (12.25 usr + 0.00 sys = 12.25 CPU) m_array_M: 5 wallclock secs ( 4.91 usr + 0.00 sys = 4.91 CPU) m_for: 12 wallclock secs (11.60 usr + 0.00 sys = 11.60 CPU) m_for_M: 5 wallclock secs ( 4.91 usr + 0.00 sys = 4.91 CPU) m_while: 8 wallclock secs ( 8.41 usr + 0.00 sys = 8.41 CPU) m_while_M: 4 wallclock secs ( 3.94 usr + 0.00 sys = 3.94 CPU) tr: 2 wallclock secs ( 1.31 usr + 0.00 sys = 1.31 CPU) === check counts === _m_while_M 2000 _c_strncmp 6000 _m_for 6000 _m_array 6000 _c_strstr 6000 _m_while 6000 _c_strncmp_M 2000 _tr 6000 _m_for_M 2000 _m_array_M 2000 _c_strstr_M 2000 -- snip -- here is the benchmark code - notice the use of Inline.pm to get some more speeeed by using C. can anyone think of a faster way to count one substring in another??? -- snip --