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."

Reply via email to