

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
These lab notes provide instructions and exercises for using perl and regular expressions as part of the bif 101 fall 2008 course. Details on creating a perl program called 'greet.pl', listing the contents of provided text files, and working through various regex exercises from the textbook. For each exercise, the document asks students to paste the results into their word file and describe what the pattern matched.
Typology: Lab Reports
1 / 2
This page cannot be seen from the preview
Don't miss anything!
#!/usr/bin/perl
use strict; use warnings;
my $greeting = "Hi there person. Guess what? person has just won a contest!";
my $name;
print "type your name: ";
$name = <>; chomp($name); # remove the end of line character
print "original greeting is:\n$greeting\n";
$greeting =~ s/person/$name/g;
print "new greeting is:\n$greeting\n";
use strict;
Read the text in ch 4 very carefully. We will get started as a group so that you understand how to proceed. You should have two windows open, one should have the regex.pl program in it – this is where you will edit the program and save changes. The other window should be a command prompt where you will run the program. This lab involves making changes to the program and running it, then analyzing the output.
Label your answers with page numbers!!
P 58:
Copy/paste the results of the q[^u] pattern into your Word file. Describe what the pattern matched.
Going Back for More section: a-d, for each of these paste in your regex pattern and say how many results you got back, for part d explain what you decided to look for AND paste in your regex pattern and number of results.
P 59: How many results do you get from the G[^T] pattern? Describe what this pattern matched.
Going Back for More: a-c, for each of these paste in your regex pattern and say how many results you got back, for part c explain what you decided to look for AND paste in your regex pattern and number of results.
P 62: how many results do you get for the question at the top of the page? Paste three of the words returned by this pattern.
Going Back for More – say how many results for part a, create your own pattern for part b, describe it and paste it into your Word file, then say how many results it yields.
P 63: How many results do you get fo rhte question at the top of the page? Paste three of these into your World file.
Going Back for More – say how many results for part a, create, show, and describe a pattern for part b and say how many results it returned, paste in one of the results (if any)
P 66: how many results do you get for the question at the top of the page? Paste three of the words returned by this pattern.
Going Back for More – say how many results for parts a-c, for each also paste in a few of the words returned and paste in your regex patterns.
P 67: How many results do you get fo rhte question at the top of the page? Paste three of these into your World file.
Going Back for More – say how many results for parts a-c, for each also paste in a few of the words returned and paste in your regex patterns.