If I run Perl from Emacs, it usually processes the text area or inserts the results of the command into the buffer.
M-! (which is Meta-Shift-1) will execute a shell command and display the results in a mini-buffer.
A command prefix with a prefix argument (M-1) will insert the command output at a point.
For example, cutting (x) an HTML file into an empty buffer: M-1 M-! perl -MCGI=:standard -e 'print start_html("Hello World"),end_html'
The following will be displayed:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Hello World</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body>
source share