473,395 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Except script error

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
Jul 19 '05 #1
1 3311
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.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: George Young | last post by:
I have a bunch of blanket "except:" clauses like: class DatabaseError(StandardError): pass class OperationalError(StandardError): pass try: stuff except _pg.error, msg: raise...
2
by: Thorsten Kampe | last post by:
What is the best way to except two errors, when the except handling in both cases is the same? "except:" would just except every error and not just those I want. except Attribute error:...
12
by: SAN CAZIANO | last post by:
is there an istruction like the try ..... except.....
7
by: Christopher Benson-Manica | last post by:
Thanks to the fact that Safari and other browsers have decided that window.onerror is not worth supporting, I'm looking for a clean(er) way to catch errors than simply tossing try/except blocks in...
17
by: Randy Webb | last post by:
I know that the /g flag will match all occurrences. Is there a way, with a Regular Expression, to match all occurrences *except* the last one? pattern = /df/g; var myString = "asdfasdfasdfasdf";...
2
by: Hari Sekhon | last post by:
I want to wrap a whole script in try ... except. What is the best way of doing this? Consider the following: - try: import <modules> <CODE>
20
by: John Salerno | last post by:
I'm starting out with this: try: if int(text) 0: return True else: self.error_message() return False except ValueError: self.error_message()
7
by: oscartheduck | last post by:
I have a small script for doing some ssh stuff for me. I could have written it as shell script, but wanted to improve my python skills some. RIght now, I'm not catching a syntax error as I'd...
7
by: somnamblst | last post by:
I am using jQuery & hideAllExcept.js from this demo tute http://enure.net/dev/hide-all-except-one/ The issue is that on a page with other content, the images I have placed in the toggleThis...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.