escaping ~

Discussion in 'Perl Misc' started by Alythh, Jul 20, 2004.

  1. Alythh

    Alythh Guest

    I am confused.

    when using the script:
    ....
    $t = new Net::Telnet (Timeout => 10, Prompt => 'sisrv1:\~> ');
    ....
    I keep on getting the warning:

    ignoring bad Prompt argument "sisrv1:~> ": missing opening delimiter
    of match operator at /0ale/excursions/digital/script/bck-net.pl line
    13

    this even when I use "sisrv1:\~> ", or quotemeta("sisrv1:\~>")

    how do I escape that damned ~ ?

    thanks!

    Alessandro Magni
     
    Alythh, Jul 20, 2004
    #1
    1. Advertising

  2. Alythh

    Anno Siegel Guest

    Alythh <> wrote in comp.lang.perl.misc:
    > I am confused.
    >
    > when using the script:
    > ...
    > $t = new Net::Telnet (Timeout => 10, Prompt => 'sisrv1:\~> ');
    > ...
    > I keep on getting the warning:
    >
    > ignoring bad Prompt argument "sisrv1:~> ": missing opening delimiter
    > of match operator at /0ale/excursions/digital/script/bck-net.pl line
    > 13
    >
    > this even when I use "sisrv1:\~> ", or quotemeta("sisrv1:\~>")
    >
    > how do I escape that damned ~ ?


    Swearing won't help, especially because ~ is innocent. It would have
    helped more to take it out for a test:

    Net::Telnet->new( Timeout => 10, Prompt => 'sisrv1:> ');

    That gives you the same error as before.

    Net::Telnet expects a complete regex for the Prompt parameter, including
    the delimiting //, so

    Net::Telnet->new( Timeout => 10, Prompt => '/sisrv1:~> /');

    would work.

    Anno
     
    Anno Siegel, Jul 20, 2004
    #2
    1. Advertising

  3. -berlin.de (Anno Siegel) writes:

    > Net::Telnet expects a complete regex for the Prompt parameter, including
    > the delimiting //, so
    >
    > Net::Telnet->new( Timeout => 10, Prompt => '/sisrv1:~> /');


    I think the terminology "complete regex" is confusing. The shashes
    you see in a regex literal are no more part of a regex than the quotes
    you see in a string literal are part of the string.

    What Net::Telnet expects is a fragment of Perl source code containing
    a match operator. As I said just recently[1]: Yuch!

    [1] http://groups.google.com/groups?selm=

    --
    \\ ( )
    . _\\__[oo
    .__/ \\ /\@
    . l___\\
    # ll l\\
    ###LL LL\\
     
    Brian McCauley, Jul 21, 2004
    #3
    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. Ben

    Escaping ' in Javascript ?

    Ben, Nov 7, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    9,324
    mikeb
    Nov 10, 2003
  2. Swanand Mokashi

    Re: Escaping a URL in XSL/T

    Swanand Mokashi, May 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    539
    Swanand Mokashi
    May 13, 2004
  3. Teemu Keiski

    Re: Escaping a URL in XSL/T

    Teemu Keiski, May 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    529
    Teemu Keiski
    May 13, 2004
  4. George Durzi

    Escaping a CrLf in JavaScript

    George Durzi, Jul 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,413
    George Durzi
    Jul 6, 2004
  5. Mike P

    escaping characters

    Mike P, Mar 29, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    381
    Karl Seguin [MVP]
    Mar 29, 2006
Loading...

Share This Page