On 3/22/06, Alan_C <[EMAIL PROTECTED]> wrote: > In emails I'm receiving from this list when I've copy/pasted into editor then > save the file as Perl script gives the file many of the decimal 160 (as > reported by perltidy) characters. Perl (when attempt to run said script) > reports such character on the commandline as xA0
This character is, I believe, the "non-breaking space". It's often used in rendering code which might otherwise not be properly formatted in a web browser, but it ruins the code for copy-and-paste. > $_ =~ s/\xA0/ /g; # xA0 to space You've got the exact right idea. I hesitate to post this one-liner, because there's nothing really wrong with the program you posted. But I use something like this for similar fixups: perl -pi.bak -e 'tr/\xA0/ /' filenames* Perl has a number of command-line options that are useful for simple file transformations, so that's how the -p and -i.bak replaced most of your code. (perlrun manpage.) The tr/// (perlop) is the transliteration operator, and it should be *slightly* more efficient at this kind of operation. (I say, it should be, but there's no substitute for benchmarking, and your data may vary. And, slightly.) But that's how I'd write it. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>