0: #!/usr/bin/perl -w
1: # As our unix printer setup is weird and I sometimes want to
2: # print to networked (HP) printers, I needed something like
3: # netcat. I was unsatisfied with <tt>telnet</tt>, as it did
4: # output stuff I didn't want, and I didn't want to add the
5: # redirection to /dev/null. Perl to the rescue:
6:
7: use strict;
8: use IO::Socket;
9:
10: select IO::Socket::INET->new(PeerAddr => shift, PeerPort => (shift || 23));
11: print
12: for <>;
13:
14: __END__
15: # or, as a oneliner:
16: perl -MIO::Socket -pe 'BEGIN{select IO::Socket::INET->new(PeerAddr=>shift,PeerPort =>(shift||23))}'
In reply to Poor mans Netcat by Corion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |