in reply to How to read code from file and execute it in loop ?

Place the code to execute repeatedly into a sub. Call the sub in the loop. At this point, you're two lines away from having a module. Why don't you make it a module?
  • Comment on Re: How to read code from file and execute it in loop ?

Replies are listed 'Best First'.
Re^2: How to read code from file and execute it in loop ?
by Anonymous Monk on Jan 06, 2010 at 00:01 UTC
    Hi,

    thanks for response. It seems interesting, can you please help with some simple example ?

    Thanks in advance, regards, bulek.

      # MyModule.pm package MyModule; sub mysub { print("Hello World\n"); } 1;
      use MyModule; MyModule::mysub() for 1..10;