On 04/29/2018 09:32 PM, Andrew Kirkpatrick wrote:
There is not enough context to answer or even reproduce the problem -
how are the variables declared and what values do they have just prior
to this line? Also, what version of rakudo?

On 30 April 2018 at 11:29, ToddAndMargo <toddandma...@zoho.com> wrote:
Hi All,

These two throw an operating on a "Nil" error:
     $PartsStr ~= "$PartNo<br>";
     $PartsStr ~= "{$PartNo}<br>";


But this does not:
     $PartsStr ~= "{$PartNo}" ~ "<br>";


And this does not either:
     $PartsStr ~= "abcde<br>";

Huh?


Many thanks,
-T


$ perl6 -v
This is Rakudo version 2018.02.1 built on MoarVM version 2018.02
implementing Perl 6.c.


<code>
sub TransferParts() {
    my $ClipStr;
    my $PartNo;
    my $Description;
    my $Qty;
    my $ItemPrice;

    $ClipStr = ReadSecondaryClipboard();
    # PrintRed( "$ClipStr\n" );
# for split( '', $ClipStr ) -> $Char { say "$Char = <", ord( $Char ), ">" };

    $ClipStr ~~ s:global/ ord( 10 )/"\n"/;
    for split( "\n", $ClipStr ) -> $Line {
        if not $Line { last };
        # PrintBlue( "<$Line>\n" );
# for split( '', $Line ) -> $Char { say "$Char = <", ord( $Char ), ">" }; say "\n\n";

        $Line ~~ m/(.*?)\t(.*?)\t(.*?)\t(.*)/;
        $PartNo      = $0;
        $Description = $1;
        $Qty         = $2;
        $ItemPrice   = $3;
# PrintBlue( "PartNo <$PartNo>\nDescription <$Description>\nQty <$Qty>\nItemPrice <$ItemPrice>\n\n" );

        $PartsStr ~= "{$PartNo}" ~ "<br>";
        $PartsStr ~= "{$Description}" ~ "<br>";
        if $Qty > 1 { $PartsStr ~= "<b>" };
        $PartsStr ~= "Qty = {$Qty}" ~ "<br>";
        if $Qty > 1 { $PartsStr ~= "</b>" };
        $PartsStr ~= "Item Price   ~{$ItemPrice}" ~ "<br>";
        $PartsStr ~= "<br>";
    }
}
</code>

Reply via email to