Re: [MacPerl-AnyPerl] macperl deletes lines ....
[email protected] (Shelly Spearing) Tue, 19 Jun 2001 11:02:06 -0600
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <B754E1AE.E44%[email protected]> |
On 6/19/2001 9:33 AM, "Brandon Barker" <[email protected]> wrote: > I'm having trouble writing a script that will remove the regular > expression "<B>" in a text file in macperl. ... > $newsFile =~ s/<B>//g; *If* you're parsing HTML, it might be safer to use: $newsFile =~ s/<B>//ig; So that the entirely valid construction "<b>" will also be removed. And, you might want the following instead: $newsFile =~ s/<\/?B>//ig; So that both open and close tags are removed. This brings up another question for the gurus out there: I tend to backslash just about all punctuation marks, especially those that have special meaning(s) in perl. Thus I would have written: $newsFile =~ s/\<\/?B\>//ig; In general, is this a good habit on my part, or is it frowned upon because it clutters the code? I've written perl in a vacuum for so long that I've lost touch with the etiquette. --Shelly ----------------------------------------------------------- Shelly Spearing Systems Engineer, LANL Advanced Accelerator Applications AAA Project Director's Office http://aaa.lanl.gov/atw [email protected], MS H836, 505-665-0587 FAX: 505-667-0449 "A smart mind is like a parachute: neither functions when closed."