Form Letter Using Regular Expressions


Here's a simple form letter: Dear <FIRST>, You have been selected as the winner of a <PRIZE>! Free! We know that a <PRIZE> will be enjoyed by everyone in the <LAST> household. Yes, <SUCKER>, this is your lucky day. Be sure to contact us at ...
Here's a script which fills in the blanks: #!/usr/bin/perl -w $first = "John"; $last = "Jones"; $prize = "six-pack of soda"; while(<>){ s/<FIRST>/$first/g; s/<LAST>/$last/g; s/<SUCKER>/$first $last/g; s/<PRIZE>/$prize/g; print; } #use: ./form_letter.pl form.letter

ASSIGNMENT: