Csci3003_midterm1_review - Csci 3003 Midterm Exam #1 Review...

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

View Full Document Right Arrow Icon
Csci 3003 Midterm Exam #1 Review I ’ve put together several topics that will be covered on the Midterm #1 exam and a list of example questions to help in your studying. The exam will consist of a mix of questions about short pieces of code (e.g. what’s wrong with this statement?, what’s the value of this variable?, fill in the missing pieces of code that would accomplish some task, etc.) as well as a few questions that will require you to formulate code to solve a small problem. Topics Covered Variables, Syntax, and Operations in Perl o Numeric variables and operators (*, - , +, **, ++, - -, +=, -= , *=, etc.) o String variables V alid formation of strings ( “ “) Operations on strings (length, substr, concatenating strings, reverse) Substitution and translation (transliteration) Comparing strings (eq, ne) and checking strings for patterns ( =~ /pattern/) Printing output (i.e. print function) o Printing strings/number variables o Special characters: \n, \t , escape characters for printing special chars. (e.g. \@) Reading from/writing to files o Open function ( > or < syntax) o Readline function: e.g. <INFILE> o Reading files with loops (using the $_ variable) o Close function
Background image of page 1

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

View Full DocumentRight Arrow Icon
Arrays o Valid syntax for creating/accessing/modifying arrays (when do you use @ vs. $, index starts at 0!) o Operations on arrays Removing elements from arrays: pop, shift Growing arrays: push, unshift Getting the length of an array (scalar function, $#array ) Creating a single string from an array (e.g. for printing): join function Creating arrays from formatted strings: split function (e.g. getting data from a tab-delimited file) Hashes o Fundamental concept of a hash how is it different than an array? (key-value pairs vs. ordered lists) o Valid syntax for creating/accessing/modifying hashes (when do you use % vs. $) o Functions for hashes keys function (returns an array of keysin the hash) (elements are always unique)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/21/2011 for the course CSCI 3003 taught by Professor Staff during the Spring '08 term at Minnesota.

Page1 / 7

Csci3003_midterm1_review - Csci 3003 Midterm Exam #1 Review...

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

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