Huh.  The script is not too long so I will post it here for people to
see since I cannot see anything wrong with it.  It is just
embarrassing to give out bad code.

All it does is solves a bucket problem, which I have been working on
for something else.

------------------------------------------------------------

my @wArray;
my @xArray;
my @yArray;
my @zArray;

for 0..4 -> my $i {
        @wArray[$i] = $i * 10.5;
}

for 0..6 -> my $j {
        @xArray[$j] = $j * 7;
}

for 0..12 -> my $k {
        @yArray[$k] = $k * 3;
}

for 0..18 -> my $l {
        @zArray[$l] = $l * 2;
}

my %hash;
my $key = 0;

for 0..4 -> my $i {
        my $w = @wArray[$i];

        for 0..6 -> my $j {
                my $x = @xArray[$j];
                for 0..12 -> my $k {
                        my $y = @yArray[$k];
                        for 0..18 -> my $l {
                                my $z = @zArray[$l];

                                if(($w + $x + $y + $z) == 35) {
                                        my @total = ($i, $j, $k, $l);
                                        %hash{$key} = [EMAIL PROTECTED];
                                        $key++;
                                }
                        }
                }
        }
}

for %hash.sort.keys -> my $key {
        my @total = %hash{$key};

        print "$key: " ~ @total[0] ~ "|" ~ @total[1] ~ "|" ~ @total[2] ~ "|"
~ @total[3] ~ "\n";
}

On 5/23/06, Ovid <[EMAIL PROTECTED]> wrote:
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