Reply to topic  [ 2 posts ] 
a wordlist in perl without the print command 
Author Message

Joined: 2007-04-12 14:59:36
Posts: 201
The manual says that the original dedicated Perl macros are kept for backward compatibility, but you don't need them any more since you can integrate Perl into Nisus Macros. But earlier Nisus Perl macros often used the print command, which is anoutput command. Those earlier dedicated macros would define where the output goes. But how to do that within a Nisus macro? Let's say you have a list of words and you would like to pass this @wordlist on to Nisus as a real list with returns or something as separators. How to do that without the print command?


2007-05-07 04:39:41
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 3682
Location: San Diego, CA
Post 
You have two options. The first is to pass the word list back as a scalar, eg:

Code:
$str = ''
Begin Perl
    @words = ('red', 'green', 'blue');
    $str = join( "\n", @words );
End
Insert Text $str

Your other option is to use the print statement and simply direct the output to the current document:
Code:
Begin Perl
    #Nisus Macro Block
    #destination front selection
    #End Nisus Macro Block
    @words = ('red', 'green', 'blue');
    $str = join( "\n", @words );
    print $str;
End


2007-05-07 14:26:33
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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