JavaDeploy
SiteMap
Perl 1
Perl 2
ASP
XML
Regular Expressions
«Prev
Next»
Perl Intro
Perl Course
Obtaining web Perl
Installing Perl
Learning Perl
Perl History
Perl Language
General Syntax Structure
Working with Testbed
Perl Conclusion
Perl Variables
Scalar Types
Scalar Variable Syntax
Perl Scalar Context
Numeric Strings Literals
Perl Lists
Perl Arrays
Accessing Array Members
Perl Array Subscripts
Perl Stack Array
Shift Unshift
Perl Join Function
Split Function
Perl Hash Functions
Perl Hash Index
Perl Operators
Terms Operators Expressions
Operator Precedence
Perl Math Operators
Perl String Operators
Increment Decrement
Boolean Relational
Match Operator
Substitute Operator
Translation Operator
Pattern Matching Variable
File Test x Operators
Named Unary list Operators
Input Output Operators
Math Operators
Regular Expressions
Using Regular Expresions
Regular Expressions References
Perl Pattern Matching
Pattern Matching Modifiers
Perl Substitution Operator
Perl Substitution Modifier
Perl e Modifier
e Substitution Modifier
Perl Selective Replacement
Perl Subexpressions Selective Replacement
Perl split Function
Extended Regular Expressions
Regular Expressions Conclusion
Regular Expression - Quiz
Perl s Operator - Exercise
Objective:
Use the
s//
operator and appropriate modifiers to replace one element with another in a file.
Instructions
Write a program that reads an HTML file and replaces all occurrences of the
<BLINK>
tag in the HTML file with the text "We do not need no stinkin' <BLINK>!" Print the results to the screen. It is not necessary to modify the HTML file itself.
Remember that there may be other text, including new lines, between the word
BLINK
and the ending
>
.
If you do not have a file handy, you can just imagine that you have a file with the <BLINK> tag in it, and write the program for your imaginary file.
Paste your code in the area below and click the
Submit
button when you are finished.
Submit