At 03:33 PM 5/15/01 +0100, Steve Haigh wrote:
>I'm currently writing some scripts to send bytes to a UDP server.
>
>
>use IO::Socket;
>
>$msg = '0xa';
>
>$sock = IO::Socket::INET -> new(PeerAddr => '10.0.0.40',
> PeerPort => 5525,
> Proto => 'udp',
> Type => SOCK_DGRAM) || die ("Socket
> failed : $@");
>
>print $sock $msg;
>
>
>The perl seems to work fine apart from one thing. I'm trying to send a
>value of 10 ($msg) and what i'm getting at the server is 49.
Not with the code above; you've set $msg to the string '0xa'.
>I'm guessing this is something to do with the ascii value of '1' being 49.
I agree.
>Any ideas how i can send the byte value?
perldoc -f pack.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com