Re: [MacPerl-AnyPerl] singlesqoutes <-> doubleqoutes
[email protected] (Shelly Spearing) Fri, 20 Jul 2001 14:14:30 -0600
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <B77DED46.1357%[email protected]> |
On 7/20/2001 2:08 PM, "allan" <[email protected]> wrote: > $str =~ s/'/some_temp_for_singles/g; > print "OK: ", $str; > > #this approach would not be OK: > #$str =~ s/'/"/g; > #$str =~ s/"/'/g; This is a fairly standard two element swapping. You have one extra step that could be deleted. Once $str =~ s/'/some_temp_for_singles/g; has executed, there are no \' chars remaining. You can go directly to $str =~ s/\"/'/g; $str =~ s/some_temp_for_singles/"/g; There may be a more elegant way, but this is an improvement over what you have. --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."