LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2003, 06:33 AM   #1
andox
Member
 
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100

Rep: Reputation: 15
perl IO


#!/usr/bin/perl



use IO::Socket;



$local = IO::Socket::INET->new(proto=>"TCP", localport=>"23", Listen=>"1")
or die "error can't open socket\n";

# wait for connection and create a new handle

$remote = $local->accept;
$remote->autoflush(1);

while (<$remote>) { print }
close $local, $remote;

I got this code off a site but it doesn't work when i tried to connect.
there's no compile error.. but when it's running nothin happens. and when i do try to connect from my other computer via telnet.. it doesn't work.
 
Old 06-27-2003, 06:38 AM   #2
andox
Member
 
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100

Original Poster
Rep: Reputation: 15
another question.. wat does "->" do? and wat about "my"?
same with "asomatos" the site i went i found this has no explanations.

Last edited by andox; 06-27-2003 at 06:48 AM.
 
Old 06-27-2003, 08:11 AM   #3
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
you're asking basic perl questions. go read an introductory tutorial.
 
Old 06-27-2003, 01:40 PM   #4
andox
Member
 
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100

Original Poster
Rep: Reputation: 15
i did!!
 
Old 06-28-2003, 11:50 AM   #5
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
"my" is used to create lexically scoped variables, ie local variables that get destroyed as soon as you reach the closing braces of the block where they were created.
Normally without any modifier perl creates global variables, you can specifically create them using "our". There are also dynamic variables ("local"), which act like "my", but can be used by functions called within the block.

Correct me if i am wrong as i haven't done much perl lately...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM
can i set ~/public_html/perl as a perl directory for apache? doublefailure Linux - Networking 1 07-09-2002 04:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration