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. Advertising

  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. Advertising

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. John Salerno
    Replies:
    20
    Views:
    821
    John Salerno
    Aug 11, 2006
  2. Fabio Z Tessitore

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

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

    try -> except -> else -> except?

    David House, Jul 6, 2009, in forum: Python
    Replies:
    2
    Views:
    323
    Bruno Desthuilliers
    Jul 6, 2009
  4. Peng Yu
    Replies:
    1
    Views:
    502
    Steven D'Aprano
    Nov 18, 2009
  5. MRAB
    Replies:
    0
    Views:
    806
Loading...

Share This Page