Can an arduino perform this task (pulse counter) ?

How can the code be modified to calculate frequency based on measuring the period for a fixed number of pulses? Say 50 or 100 pulses.