Feb22 - CSE262: Programming Languages Instructor: Dr. Liang...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE262: Programming Languages Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 22, 2007 Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Outline ¡ Recap ¡ Pointer types ¡ Introduction to Perl ¡ Record types ¡ Summary and homework Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Some Pointer Rules ¡ From Stanford CS Education Library ¡ A pointer stores a reference to its pointee. The pointee, in turn, stores something useful. ¡ The dereference operation on a pointer accesses its pointee. A pointer may only be dereferenced after it has been assigned to refer to a pointee. Most pointer bugs involve violating this one rule. Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Other Issues Discussed ¡ Bad pointers ¡ Implicit scaling *(p+5) ¡ Dangling pointers ¡ Lost heap-dynamic variables Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Outline ¡ Recap ¡ Introduction to Perl ¡ Record types ¡ Homework and programming assignment Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Write Your First Perl Program #!/usr/bin/perl # My First Perl Program use strict; # pragma use warnings; print "What is your name?"; my $username; $username = <STDIN>; chomp($username); print "Hello, $username. \n"; example1.pl Must have this at the top of each Perl program Standard output Comments Explicit variable declaration by keyword my due to the strict mode File handle Remove “new line” by a built-in fun http://www.perl.com/doc/manual/html/pod/perlfunc/ Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Run Your First Perl Program ¡ How to run? perl example1.pl ¡ perl script ¡ perl-compiler < script | perl-interpreter ¡ perl-compiler: source-code to parse-tree ¡ No generation of C code, assembly language, nor machine code Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/20/07 Scalar Data - String ¡ String ¡ A single-quoted string is evaluated to be its face...
View Full Document

This note was uploaded on 08/06/2008 for the course CSE 262 taught by Professor Cheng during the Spring '07 term at Lehigh University .

Page1 / 28

Feb22 - CSE262: Programming Languages Instructor: Dr. Liang...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online