Except script error

R

ruud

I am rewriting my Except script from bash to Perl.
But i get an syntax error at the Send command.
Google is not helping me out here, so i hope for an answer here.

Here is a part of the script:

#!/usr/bin/perl -w
use Expect;

$post = "post";
$quit = "quit";

spawn telnet "news.nl-netwerken.com 119";

expect {
200}

send "$post\r";
expect {
340}

And here is the error:
syntax error at ./p line 12, near "send"
Execution of ./p aborted due to compilation errors.

What is wrong with this line ?
Thanks for your time.
 
J

Jürgen Exner

ruud said:
I am rewriting my Except script from bash to Perl.
But i get an syntax error at the Send command.
Google is not helping me out here, so i hope for an answer here.

Here is a part of the script:

#!/usr/bin/perl -w
use Expect;

$post = "post";
$quit = "quit";

spawn telnet "news.nl-netwerken.com 119";

expect {
200}

send "$post\r";
expect {
340}

And here is the error:
syntax error at ./p line 12, near "send"
Execution of ./p aborted due to compilation errors.

What is wrong with this line ?

Nothing. The problem is with the preceeding code segment. What is
expect {
200}

supposed to mean? It's not a function call, it's not a statement, it's not a
hash element, ...

Rearranging the white space you have a single statement

expect {200} send "$post\r";

That doesn't look right to me.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top