Thanks for replying joe,
maybe if you see a bit more code you can get an idea for what I'm trying to
do :

use Net::Telnet;
use IO::File;

  $prmpt =~  /^(.*:\/home\/oracle[:=>]{1,2})/;
  $telnet = new Net::Telnet(-prompt => $prmpt, -Errmode => 'die');
  $telnet->open($HOST);
  $telnet->login($USER,$PASSWORD);
  $telnet->cmd(-string =>"",-Timeout => 20,-prompt => $prmpt);
  @lines = $telnet->cmd("cat .netrc");
  $telnet->cmd(-string =>"",-Timeout => 20,-prompt => $prmpt);

  $netrctxt = new IO::File;
  $netrctxt->open('>c:\temp\netrc.txt') or die "Cannot open
C:\temp\netrc.txt for writing";
  $netrctxt->print(@lines);
  $netrctxt->close;
  $telnet->close;

Don't know if you can see what I'm trying to do, but I want the telnet
prompt to match $prmpt. Maybe I'm Tackling it the wrong way, but I'm still
not a perl guru (yet ;-) ).

I still get the following error message though :

bad match operator: opening delimiter missing: ^(.*:/home/oracle[:=>]{1,2})
at C:\Documents and Settings\lcullip\My
Documents\programming\perl\oracheck.pl line 41

WTH am I doing wrong ?

TIA
Lee

----- Original Message -----
From: "Joseph P. Discenza" <[EMAIL PROTECTED]>
To: "Lee Cullip" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 12:35 PM
Subject: RE: Regular Expression Problem


Lee Cullip wrote, on Wednesday, November 20, 2002 06:50
: Can anybody tell me what is wrong with the following line ?
:
:   $prmpt = /(^.*[:]\/home\/oracle[:=>]{1,2})/;
:
: I'm trying to use the value of $prmpt in a call to Net::Telnet but before
I can
: use the variable $prmpt, perl is complaining about the format of the
pattern.

Please try to post in plain text. Thanks.

Do you really want $prmpt to be true if $_ matched your pattern,
and false if it didn't? Perhaps you meant "=~" instead of "=".

What exactly is Perl's "complaint" about your pattern? I have a
few suggestions:

o Use a different pattern delimiter if you want to match
forward slashes, to avoid the "leaning toothpick"
phenomenon.
o You don't need to turn a single character into a
character class: remove the brackets from the "[:]".
o Unless you need $1 later, you don't need parentheses
around the whole pattern. My guess is that Perl
didn't like having the "start" anchor inside parens.

Rewriting your pattern, then, I get this:

   $prmpt =~ !^(.*:/home/oracle[:=>]{1,2})!;
   $prmpt = $1;

Is that what you really meant?

Good luck,

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]

          Carleton Inc.   http://www.carletoninc.com
          574.243.6040 ext. 300    fax: 574.243.6060

Providing Financial Solutions and Compliance for over 30 Years
***** Please note that our Area Code has changed to 574! *****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to