Class Meeting: Perl I
Admin
Assignment
Notes
- notes on Perl
- Perl: the basics
- try this... write a Perl script that will
- take as input a text file called "foo.txt"
- produce as output a file called "bar.txt"
- input should have several things done to it to produce output:
- any line that has the string "Ignore" in it should be removed entirely
- any line that has the string "#" in it should have that string
and all characters to end-of-line removed
- any string "*DATE*" should be replaced by the current date
- create another file "baz.txt" that contains all the strings
removed from input
Here is a solution
Here is another... it uses the implicit $_ variable
Here is a third... it uses boolean expressions in
place of if statements
- try this for more fun... write a Perl script that will
- take as input a text file called "foo.txt"
- produce as output a file called "bar.txt"
- output will be input with any duplicate lines removed
- remember the Perl mantra: "There's more than one way to do it."