Can an arduino perform this task (pulse counter) ?

Yes, it starts as soon as code starts to run.

Yes but it needs to be an unsigned long variable type, and it is very not recommended to try and change its value. In fact I am not sure that would work anyway.

No it will not work, because you should never use absolute numbers of millis() ticks as they only happen once from the start of running the code. You need to use:-

target = millis() + 40;