# @ctOutput : Content of some source file, containing # among others some 'include' directives foreach( @ctOutput ) { if( $_ =~ /^\s*include (.*)/ ) { open(INC, "<$1"); push @ctOutput, ; # <==== !!!! close INC; } else { # process non-include lines here } #### foreach (@x) { ..... push @x,'something'; ..... }