A
now-defunct website that I found on Google offers solutions which you can run from within Perl by using the backtick operator. These solutions depend upon the OS within which Perl runs.
Given a textfile, file1, one may wish to prepend or insert an
external file, fileT, to the top of it before processing the file.
Normally, this should be done from the Unix or DOS shell before
passing file1 on to sed (MS-DOS 5.0 or lower needs 3 commands to do
this; for DOS 6.0 or higher, the MOVE command is available):
copy fileT+file1 temp # MS-DOS command 1
echo Y | copy temp file1 # MS-DOS command 2
del temp # MS-DOS command 3
cat fileT file1 >temp; mv temp file1 # Unix commands
UPON FURTHER CONSIDERATION...I was wrong.
The UNIX cat solution above is probably simply reading the file into memory as text and writing it out again.
The DOS copy fileT+file1 temp only seems to work with text files, not with binary ones. Therefore it also is probably simply copying a file into memory as text and writing it out again.
Therefore the correct answer is probably the one given earlier in this thread. You cannot do it without complicated manipulation of file pointers. Maybe you cannot do it at all. And there is no ready-made command in Perl or the DOS or UNIX shells to do it.