This seems to work for me:

  pugs -e 'say (1,2,3).join("|")'
  1|2|3

Or even:

  pugs -e '(1,2,3).join("|").say'
  1|2|3

Cheers,
Ovid
 
-- If this message is a response to a question on a mailing list, please send 
follow up questions to the list.
 
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

----- Original Message ----
From: Fagyal Csongor <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: perl6-users@perl.org
Sent: Tuesday, May 23, 2006 12:11:07 PM
Subject: Re: Simple Print/Say Question

Chris,

Strange. I have just tried this using an old version (6.2.3) of Pugs:

my (@array) = 1,2,3;
print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] ~ "\n";

It prints
1|2|3
on my terminal.

Gabor's join-ed version also works.

- Fagzal

> Oops.  That last . is a typo on my part.  Sorry about that!  It should
> read, which it does in my code:
>
> print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] ~ "\n";
>
> However, your say join technique does not work.  I will keep on it but
> for now I am off to dinner!
>
> Thanks!,
> Chris
>
> On 5/23/06, Gabor Szabo <[EMAIL PROTECTED]> wrote:
>> On 5/23/06, Chris Yocum <[EMAIL PROTECTED]> wrote:
>> >
>> > 1|2|3
>> >
>> > I would say something like:
>> >
>> > print $array[0] . "|" . $array[1] . "|" . $array[2] . "\n";
>> >
>> > not the best way but it works.
>> >
>> > In Perl6 if say something like this:
>> >
>> > print @array[0] ~ "|" ~ @array[1] ~ "|" ~ @array[2] . "\n";
>> >
>> > I get
>> >
>> > 1 2 3 | | |
>> >
>> > My question is: why is it doing that or, more to the point, what am
>> I doing wrong?
>> >
>>
>> I am not sure, maybe the . before "\n" cause the problem but why not
>> try this one:
>>
>> my @array = (1, 2, 3);
>> say join "|", @array;
>>
>> Gabor







Reply via email to