Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How can I send Ctrl-D over Telnet session

by RMGir (Prior)
on Sep 10, 2008 at 08:59 UTC ( #710306=note: print w/replies, xml ) Need Help??


in reply to How can I send Ctrl-D over Telnet session

ctrl-d is just the byte 0x04 (just like space, character 32, is the byte 0x20), so in perl, ^D is "\x4".

So just put a "\x4" in your string where you want the ctrl-D, or even better:

# also declare other ctrl chars you need... my $ctrlD = "\x4"; my $escape = "\x1b"; #... more code here... cmd("Send all the\ncommands you need\nincluding a ${ctrlD}");

Mike

Replies are listed 'Best First'.
Re^2: How can I send Ctrl-D over Telnet session
by tye (Sage) on Sep 10, 2008 at 14:19 UTC

    Since asked for CTRL-D, I'd use "\cD" instead.

    - tye        

      That works... I didn't know that escape, thanks!

      Mike
Re^2: How can I send Ctrl-D over Telnet session
by Anonymous Monk on Sep 10, 2008 at 09:53 UTC
    C:\>perl -e"print qq,\cD," ♦ C:\>perl -e"print qq,\cD," |hexdump 00000000: 04 - | | 00000001; C:\>perl -e"print qq,\cD," |od -tacx1 0000000 eot 004 04 0000001 C:\>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://710306]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2020-09-20 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (119 votes). Check out past polls.

    Notices?