tr/y not deleting chars? 
Author Message
 tr/y not deleting chars?

I have the following simple script which does not do what I expect it
to do.... I want `$pre' to contain the prefix (`TEST') and `$num' to
contain the numeric portion (`012').   The output follows the script.
Am I doing something wrong or is there really something wrong with
`tr'?  I've gotten around the problem using the `s' command so I don't
need help with that....                         --Tad

----------------------------Heres the Script--------------------------
$test = "TEST012";
($pre = $test) =~ y/0-9//d;
($num = $test) =~ y/A-Z//d;
printf("prefix=%s        number=%s\n",$pre,$num);
----------------------------Heres the Output--------------------------
$Header: perly.c,v 91/01/11 18:22:48 lwall Locked $
Patch level: 44

prefix=TEST012        number=TEST012

Tue, 24 Aug 1993 09:00:13 GMT  
 [ 1 post ] 

 Relevant Pages 

1. tr/// cannot translate to chars whose codes are greater than 127

2. Using tr or y to sub out chars in a filename

3. Deleting a line w/ char match

4. if last char is comma, delete it

5. tr behavior is not what I expect

6. Tr vs. tr !@#@!#$@#%

7. tr vs. Tr

8. Did tr operator claimed compatible with unix tr program

9. chomp not chomping w/ new $/ char

10. split a string not only by a single char but also by a string

11. Newbie: sprintf ('%-20s', 48 char string) returns 48 not 20 length string

12. backslash escaping not metacharacters in a char class


Powered by phpBB® Forum Software