I want to make any perl program in such a manner that it will use all processor.

Parallel::ForkManager is for running multiple processes. Whether these will run on multiple processors is a question of how the OS handles those processes.

Also, there's no "apply to any program" option... you'll have to adapt every program in question separately. Have you seen the examples in the docs and played with them? If so, where did you get stuck?

It doesn't work that way. With Parallel::ForkManager you can easily start multiple processes that run at the same time - but you have to decide on your own what you do in which process. Determining string length can't easily be parallelized that way.

This uses Sys::Cpu to find the number of CPUs the system has, then forks off that number of processes and executes the code in them. Note you'll get the output ("length of a string...") multiple times (depending on the number of processors you have in the system), because exactly the same code is run in each process. So this approach is rather nonsensical, it uses all processors (normally, depends on your OS) but simply multiplies the workload. Something more sensible would be to have each child measure a different string, e.g.:

This will hand each child a different string and thus "parallelize" the work done. This is slightly less senseless than the previous example, but only slightly, because the work done by your machine to fork off a separate process is much more than the simple act of measuring the length of a string. So, as the previous commenters have already pointed out, you need to do some thinking on exactly what you want to parallelize and how to do it in a worthwhile fashion. Anyway, hope this helps clear up some confusion.