bioBob has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use tr to do a binned replacement of a bunch of characters ASCII 33-126 where I bin the replacements as 33-42, 43-52, 53-62 and >62 and rename them 0, 1, 2, and 3.
I have tried all combinations (but not the right one) to affect this and seem to get at best replacement of all values to 3. Here are a few iterations:
###$quality =~ tr /[!"#$%&'()*][+,-./01234][56789:;<=>][?@ABCDEFGHIJKL +MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~]/0123/; ###$quality =~ tr /[\!-\*][\+-4][5-\>][\?-\~]/0123/; ###$quality =~ tr/[\x21-\x2a][\x2b-4][5-\x3e][\x3f-\x78]/0 +123/; ###$quality =~ tr/[\x21-\x2a][\x2b-\x34][\x35-\x3e][\x3f-\ +x78]/0123/; ###$quality =~ tr/[\!-\*][\+-4][5-\>][\?-\~]/0123/;
Any suggestions?
Thanks,
Bob
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using tr
by BrowserUk (Patriarch) on Feb 28, 2012 at 22:13 UTC | |
|
Re: using tr
by AnomalousMonk (Archbishop) on Feb 29, 2012 at 00:07 UTC | |
|
Re: using tr
by Eliya (Vicar) on Feb 28, 2012 at 22:16 UTC |