$bullopen = 0; $bullclose = 0; while ($_=~s###) { $bullopen++; } while ($_=~s###) { $bullclose++; } print $bullopen; print $bullclose;