Except script error

Discussion in 'Perl' started by ruud, Jan 14, 2005.

  1. ruud

    ruud Guest

    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
     
    ruud, Jan 14, 2005
    #1
    1. Advertisements

  2. 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.
     
    Jürgen Exner, Jan 14, 2005
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug Miller

    Heap error except when run with -Xint

    Doug Miller, Mar 6, 2005, in forum: Java
    Replies:
    1
    Views:
    696
    Harish
    Mar 7, 2005
  2. Florian Lindner

    Except MySQL error

    Florian Lindner, Jun 21, 2004, in forum: Python
    Replies:
    2
    Views:
    924
    Frithiof Andreas Jensen
    Jun 22, 2004
  3. Hari Sekhon
    Replies:
    2
    Views:
    360
    Bruno Desthuilliers
    Jun 21, 2006
  4. John Salerno
    Replies:
    20
    Views:
    1,225
    John Salerno
    Aug 11, 2006
  5. Fabio Z Tessitore

    who is simpler? try/except/else or try/except

    Fabio Z Tessitore, Aug 12, 2007, in forum: Python
    Replies:
    5
    Views:
    675
  6. David House

    try -> except -> else -> except?

    David House, Jul 6, 2009, in forum: Python
    Replies:
    2
    Views:
    563
    Bruno Desthuilliers
    Jul 6, 2009
  7. Peng Yu
    Replies:
    1
    Views:
    749
    Steven D'Aprano
    Nov 18, 2009
  8. ruud

    Except script error

    ruud, Jan 14, 2005, in forum: Perl Misc
    Replies:
    6
    Views:
    163
    Michele Dondi
    Jan 15, 2005
Loading...