Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
use strict; use IO::Socket; #initial variables to work with my server my $host, $port, $request, $proto = 'tcp'; my $connectresponses = 2; #my ftp server responds with 2 lines when + you connect. print "What hostname do you want to connect to? "; chomp( $host = <STDIN> ); print "What port do you want to use? "; chomp( $port = <STDIN> ); my $sock = IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Proto => $proto ) || die "Failure: $!"; print "Connection to $host on port $port successful!\n"; unless ( $port == 80 ) { for ( $i = 0; $i < $connectresponses; $i++ ) { $_ = <$sock>; print; } } print "Type commands (solely press enter to exit)\n"; &Terminal; close($sock); print "\nConnection to $host on port $port was closed successfully!\n" +; exit; #sub to emulate a terminal sub Terminal { while (1) { $request = ""; chomp( $request = <STDIN> ); print $sock "$request\n"; if ( $port == 80 ) { while (<$sock>) { print; } last; } else { unless ($request) { last; } $_ = <$sock>; print; } } }
ERRORS:
parenthesis missing arounf "my" list at test.pl line 7 print (..) interpreted as function at test.pl line 37 Global symbol "$port" requires explicit package name at test.pl line 7 Global symbol "$request" requires explicit package name at test.pl lin +e 7 Global symbol "$proto" requires explicit package name at test.pl line +7 Global symbol "$port" requires explicit package name at test.pl line 1 +3 Global symbol "$port" requires explicit package name at test.pl line 1 +5 Global symbol "$proto" requires explicit package name at test.pl line +7 test.pl has too many errors.

In reply to whats wrong? it gives me many error by yenne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2022-01-18 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (53 votes). Check out past polls.

    Notices?