Perl Tutorial: Syllabus

Instructor:
Mordechai T. Abzug
Dates & times:
2001-10-23 @ 7pm
Prereqs:
C. It would also help if you're already familiar with any other shell programming language.
Suggested book:
Programming Perl, by Larry Wall, Tom Christiansen, and Randal Schwartz, published by ora.com.

Notes

The following notes will probably make no sense unless you have some prior perl experience.

Appendix A: creating a "Hello world" perl program on gl

Type the following, exactly as it apppears:

rm -f foo
touch foo
chmod 755 foo
cat >> foo <<EOF
#!/usr/bin/perl -w

print "Hello, World!\n";

EOF
./foo


Appendix B: a useful extension for your .emacs

If you add the below to your .emacs, you can type C-c C-f and run the current buffer.
(add-hook 'perl-mode-hook '(lambda () (local-set-key [?\C-c ?\C-f] 'perl-run)))
(defvar perl-run-window-size '7 "*size of output screen for perl")
(defun perl-run () (interactive) (save-buffer) 
  (let* ((old-buffer (buffer-name)) 
	 (output-buffer "*Shell Command Output*"))
	  (shell-command (concat "./" old-buffer))
	  (set-buffer (get-buffer-create output-buffer))
	  (pop-to-buffer output-buffer)
	  (shrink-window (- (window-height) perl-run-window-size))
	  (pop-to-buffer old-buffer)
	  ))