Re: tr question (probably wrong list to ask, but ...)
[email protected] (Doug McNutt)
| Newsgroups | perl.macosx |
|---|---|
| Message-ID | <p05100305c37672c9c16c@[192.168.1.14]> |
At 01:56 +0000 12/1/07, Andy Holyer wrote: >On 1 Dec 2007, at 00:33, Joel Rees wrote: > >>This is probably the wrong list for this question, but is anyone willing to give me a clue why >> >>$line =~ tr/+/ /; >> >>would clip out the lead bytes of a shift-JIS string in a cgi script? >> >what was just expressed", but you haven't expressed anything so far, so god knows what it will match. > >I think you meant to say ".+", but that will just delete the whole string in this context. What did you want to do? + is a special representation of a space in URL encoding but it's the one-or-more collective char in perl. My guess is that the intent is to replace plus's with spaces which requires escaping the +, How about $line =~ tr/\+/ /g; where I have added the g to get them all. But what the devil is the thingy (missing char) repeated at least once? Should it not have produced a compile error or a least a warning? Was the -w switch used? -- --> On the eighth day, about 6 kiloyears ago, the Lord realized that free will would make man ask what existed before the Creation. So He installed a few gigayears of history complete with a big bang and a fossilized record of evolution. <--