|Do you know where your variables are?|
Seems like you are just starting out with vim|emacs. Both require some quality time to be spent with them to have them bent per your desires (almost). Please see :help on :buffers, :map, :make & :cwindow (which I found via tips search section of Vim home), among other commands.
I don't run a program through vim, only to check if perl will compile it (map <F5> :setlocal makeprg=perl\ -c\ %\|make<CR>). I do have an occasionally exercised key binding to run the program: map <F6> :setlocal makeprg=perl\ %\|make<CR>.
Yes, edit-Ctrl-Z-run-fg cycle is indeed tedious for more than thrice. I much prefer to use two xterm windows: one for the editor; other to run and redirect output as I like. Along with command history as pointed out earlier, there is also xterm buffer space to temporarily hold some adjustable number of lines of text.
I don't like a split window (in any of vim or emacs) which causes small viewport, thus much scrolling. On a big monitor (or two side by side), both windows will be side by side. Else, I just use my window manager's key binding to flip between the windows.
I must admit that if I were to be working on console (about 25x80 resolution) with access to only one tty, I would be extremely motivated to run a program within vim and to find a way to save output in a file which would linger around and be inserted in buffer list.
In reply to Re: How do you run your scripts with vim (or emacs)?