Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Except script error

Reply
Thread Tools

Except script error

 
 
ruud
Guest
Posts: n/a
 
      01-14-2005
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.
--
Gr. Ruud
news://news.nl-netwerken.com
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      01-14-2005
ruud wrote:
> 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

> Thanks for your time.



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: What is the difference between 'except IOError as e:' and 'except MRAB Python 0 11-18-2009 02:52 AM
What is the difference between 'except IOError as e:' and 'except Peng Yu Python 1 11-18-2009 02:38 AM
try -> except -> else -> except? David House Python 2 07-06-2009 05:48 PM
who is simpler? try/except/else or try/except Fabio Z Tessitore Python 5 08-13-2007 12:52 AM
converting a nested try/except statement into try/except/else John Salerno Python 20 08-11-2006 02:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57