Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!munnari.oz.au!frankland-river!pem From: pem@frankland-river.aaii.oz.au (Paul E. Maisano) Newsgroups: comp.lang.perl Subject: Re: more termcap.pl problems & a quick question Message-ID: <1172@frankland-river.aaii.oz.au> Date: 27 Feb 90 07:39:51 GMT References: <1171@frankland-river.aaii.oz.au> Organization: Australian AI Institute Lines: 27 In article <1171@frankland-river.aaii.oz.au>, pem@frankland-river.aaii.oz.au (Paul E. Maisano) writes: > What I came up with (rather quickly/hastily) was: > > sub p { > local($str) = @_; > $str =~ s/([\000-\037])/(($x)=unpack("c", $1),"^".pack("c", $x+0100))/eg; > print $str; > } > > This seems horribly inelegant. Suggestions anyone ? I was rather hasty... this is better: sub p { local($str) = @_; $str =~ s/([\000-\037])/"^".pack("c", ord($1)+0100)/eg; print $str; } Sorry about that... ------------------ Paul E. Maisano Australian Artificial Intelligence Institute 1 Grattan St. Carlton, Vic. 3053, Australia Ph: +613 663-7922 Fax: +613 663-7937 Email: pem@aaii.oz.au