Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!cs.umn.edu!kksys!pwcs!com50!caa From: caa@com50.c2s.mn.org (Charles Anderson) Newsgroups: comp.lang.perl Subject: flipping bits in perl Message-ID: <1991May30.231900.12417@com50.c2s.mn.org> Date: 30 May 91 23:19:00 GMT Article-I.D.: com50.1991May30.231900.12417 Organization: Com Squared Systems, Inc. Lines: 19 Yesterday a coworker asked me if I could flip all of the bits in the font file he was using, and I decided to try using perl to do it. (I could easily do it in C but I'm trying to learn perl and thought I'd give it a go.) I tried all sorts of things tr/\000-\377/\377-\000/ didn't work neither did s/./~$&/g in various type of things. I even tried unpacking it into an array and flipping from there but that wasn't very succesful either. I but a vec() into the code (something like vec("blah", 0, 1) to see if the bit twiddling would start working after that but it didn't. I'm stumped...anybody know how to do it. All I really want is a bit negation or xor $ff. -Thanks Charlie -- /-Charles-Anderson-\ | caa@c2s.mn.org || caa@midgard.mn.org \------------------/ | Com Squared Systems, voice (612) 452-9522 The rose goes in front | 1285 Corporate Center Drive fax (612) 452-3607 big guy -Crash Davis | Suite 170 | Eagan, MN 55121 (I speak for myself)