Reply to topic  [ 3 posts ] 
invalid variable name 
Author Message

Joined: 2007-03-28 07:30:34
Posts: 139
Continuing learning the new macro language and therefore Perl, the first part of an effort has the variable $vprior, which causes no complaint until the last time it appears. NWP returns the error "invalid variable name on line 10"

##cInsert Prior Right Paragraph Number##

$vprior = Read Clipboard cvPrior #get counter
$pasteStr = 'undefined'

Begin Perl #initialize counter if need be
if ($vprior == 0) {
$vprior = 1;
} else {
$vprior += 1; #<<<<<<HERE
}
End

What is wrong? Perl doesn't complain in the first If, so it apparently considers the variable name valid at that point.

Changing this line to

$vprior = $vprior + 1

brings a new complaint about an invalid assignment operator.

The named clipboard exists, and whether a value is preassigned to the clipboard or not, the same thing happens.

I am experimenting trying to use named clipboards to store variables and make them persistent until global variables come along.

Cliff Bender


2007-04-25 19:03:31
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
This is actually a few bugs teaming up to confuse you. The most critical one is that some of the macro commands don't like to have a comment on the same line. Eg: remove the comments "get counter" and "initialize counter if need be".

Also, for this line you probably meant to use a string literal:

Code:
$vprior = Read Clipboard "cvPrior"


2007-04-25 21:44:14
Profile WWW

Joined: 2007-03-28 07:30:34
Posts: 139
Post 
Ah! Thank you very much for the help (and the responses to my other posts).

Cliff Bender


2007-04-26 06:17:45
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software