use a list. lists are created either by the parentheses:

% w = ( A B C )
% # note no space before the backslash
% wMultiline = (\
X\
Y\
Z\
)
% echo $w $wMultiline
A B C X Y Z
% for(i in $w) {echo $i; echo XXX}
A
XXX
B
XXX
C
XXX

or by globbing:
% text_files = *.txt

or by expanding a whitespaced text:
% text_files = `{ 9 ls *.txt }

note the p9p's "ls" quotes whitespace in file names properly for Rc

lists are single-level; merging two lists produces new one of single
level, with all the elements in order
% a = ( foo bar )
% b = ( aa $a bb )
% echo $a
foo bar
% echo $b
aa foo bar bb

side note, the ^ operator has interesting uses for lists:

% a = ( foo bar baz)
% b = ( aa bb cc )
% flat = ( first $a last )
% echo $a
foo bar baz
% echo $flat
first foo bar baz last
% car = $a ^ $b
% echo prefix ^ $a
prefixfoo prefixbar prefixbaz
% echo $car
fooaa barbb bazcc

Reply via email to