while ( ... 'whatever here' eq 'whatever') { #all you would have to do is have a pointer to that next .pl file you want to call, have a subroutine in that other file that you can call from this one. All of this is without using CGI.pm, but that's ok, since this is just basic stuff, later you can learn about that if you want to. doThisSubroutine; #this would call the sub that has your next file pointer }