Re: [SLUG] Perl Question

From: mark@bish.net
Date: Tue Mar 22 2005 - 16:33:32 EST


It has nothing to do with SRC or DEST - this is a code snippit.

What isn't working is
while(read(BRIEF, $buff, 2)){
     $buff = hex ($buff) ^ 0xAA;
     print DEST $buff;
  }

specifically, the XOR

On Tue, 22 Mar 2005, Chris Moore wrote:

> Even your typo fix appears to be wrong. Maybe the problem is that you should
> be reading 'SRC' and not 'DEST'. Assuming 'DEST' is empty until you print to
> it then the answer your getting would make since if your reading 'DEST' for
> your input.
> Chris Moore
> cmoore@washpat.com
> ----- Original Message -----
> From: <mark@bish.net>
> To: <slug@nks.net>
> Sent: Tuesday, March 22, 2005 3:39 PM
> Subject: Re: [SLUG] Perl Question
>
>
>>
>>
>> Ignore the typo:
>> (read(BRIEF
>>
>> it should say:
>> (read(DEST
>>
>> On Tue, 22 Mar 2005 mark@bish.net wrote:
>>
>>>
>>> Why doesn't this work?
>>>
>>> open(SRC, "<$file1") or die "Can't open for reading: $!\n";
>>> open(DEST, ">$file2") or die "Can't open for reading: $!\n";
>>>
>>> binmode(SRC);
>>> binmode(DEST);
>>>
>>> while(read(BRIEF, $buff, 2)){
>>> $buff = hex ($buff) ^ 0xAA;
>>> print DEST $buff;
>>> }
>>>
>>> close(DEST);
>>> close(SRC);
>>>
>>>
>>>
>>> I get a text file filled with 170, which is 0xAA.
>>> -----------------------------------------------------------------------
>>> This list is provided as an unmoderated internet service by Networked
>>> Knowledge Systems (NKS). Views and opinions expressed in messages
>>> posted are those of the author and do not necessarily reflect the
>>> official policy or position of NKS or any of its employees.
>>>
>> -----------------------------------------------------------------------
>> This list is provided as an unmoderated internet service by Networked
>> Knowledge Systems (NKS). Views and opinions expressed in messages
>> posted are those of the author and do not necessarily reflect the
>> official policy or position of NKS or any of its employees.
>>
>>
>
> -----------------------------------------------------------------------
> This list is provided as an unmoderated internet service by Networked
> Knowledge Systems (NKS). Views and opinions expressed in messages
> posted are those of the author and do not necessarily reflect the
> official policy or position of NKS or any of its employees.
>
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:19:45 EDT