
alexloas
Novice
Oct 21, 2009, 6:16 PM
Post #3 of 4
(511 views)
|
|
Re: [shawnhcorey] NEED SERIOUS HELP!
[In reply to]
|
Can't Post
|
|
Thanks, it worked. But I forgot to clarify something. I'm trying to make the program print contractions if it recognizes them with if statements. #!usr/bin/perl my $text = join('', <>); $dont = "don't"; $text=~s/do not/$dont/g; $Dont = "Don't"; $text=~s/Do not/$Dont/g; $isnt = "isn't"; $text=~s/is not/$isnt/g; print"$text\n"; print"Replacements: (original => replacement, occurrences)\n"; if ($dont){ while($text =~/don't/g) {$count++} print "do not => don't, $count\n"; } if ($Dont){ while($text =~/Don't/g) {$count++} print "Do not => Don't, $count\n"; } if ($isnt){ while($text =~/isn't/g) {$count++} print "is not => isn't, $count\n"; } Anyone want to give it a try?
|