in reply to Suggestions

Do you mean you want to print out a file's contents, but substituting ascii code values instead of the characters? Umm, that's a one-liner: perl -e 'undef $/; print join(",", map {ord} split //, <>)'And the reverse is a one-liner also. Use chr instead of ord and switch where the comma and null character are: perl -e 'undef $/; print join("", map {chr} split /,/, <>)' Golf aside, deconstructing this will probably be instructive. Concepts that I've exploited here include:

HTH

1That gets tricky when dealing with multi-byte encodings, but ignore that for the moment....

Replies are listed 'Best First'.
Re: Re: Suggestions
by Anonymous Monk on Jul 06, 2001 at 19:44 UTC
    umm, I want to lets say take message.txt and convert its contents to ascii code values, only instead of converting for example e's to 101 I want the binary 1100101.
      for the 8 bit version (e.g. e becomes 01100101 (depending on arch)), the following should work (not tested, but should work) :
      while (<DATA>) { print unpack("b*",$_); } __END__ Just Another Perl Hacker

      may the foo be with you