in reply to How to repeat a line thrice by adding a digit into it

As the others have said, please use <code> tags to format your code and data. See How do I post a question effectively?, I know what I mean. Why don't you?, and Short, Self-Contained, Correct Example.

However, even looking at the code as far as it as is readable at the moment, it seems like your code doesn't match the data you've provided: /-number_of_SP_mem_supp\s(\d+)/g won't match any of the provided data. And the task you are describing sounds pretty straightforward, a read of perlintro (and perhaps perlrequick/perlretut) should give you all the information you need. But if you run into trouble, please feel free to ask here, making sure to follow the advice given in the above links.

use warnings; use strict; while ( my $line = <DATA> ) { if ( $line =~ /^foo/ ) { for my $x (1..3) { print "foo$x\n"; } } else { print $line; } } __DATA__ hello world foo_ bar