nisus.com
https://www.nisus.com/forum/

a wordlist in perl without the print command
https://www.nisus.com/forum/viewtopic.php?f=17&t=2228
Page 1 of 1

Author:  js [ 2007-05-07 04:39:41 ]
Post subject:  a wordlist in perl without the print command

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?

Author:  martin [ 2007-05-07 14:26:33 ]
Post subject: 

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

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/