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

Joined: 2007-04-12 14:59:36
Posts: 229
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
Official Nisus Person
User avatar

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

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

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

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