On 1/11/19 6:49 PM, Brad Gilbert wrote:
$a<a b> is short for $a{'a','b'}

This also happens in string literals

     my $a = { a => 1, b => 2 };
     say "$a<a b>"; # 1 2
     say "$a{'a','b'}"; # 1 2

A simple way to stop this is to add a backslash

     my $a = 'b'
     say "$a\<a b>"; # b<a b>

You can also call methods on variables in string literals, as long as
you use parentheses.

     my $a = Date.today;
     say "$a.year()-$a.month()-$a.day()"; # 2019-1-11

(Note that Date has a .yyyy-mm-dd() method)

---

Looking at the message you just added:

Perl 6 has a Version type.

     my $a = Version.new("12.3.4.1");
     my $b = Version.new("111.3.4.1");

     say $a before $b; # True

Also there is syntax for creating a Version literal

     my $a = v12.3.4.1;
     my $b = v111.3.4.1;

     say $a before $b; # True

There are useful methods on Versions

     my $a = v12.3.4.1;
     say $a.parts.perl; # (12, 3, 4, 1)

On Fri, Jan 11, 2019 at 8:12 PM ToddAndMargo via perl6-users
<perl6-us...@perl.org> wrote:

On 1/11/19 5:08 PM, ToddAndMargo via perl6-users wrote:
Hi All,

Now what am I doing wrong?  I need to convert the value in a
hash to a string:

$ p6 'my $x = "acme"; my Str $y; my %Vendors = ( acme => ContactName =>
"Larry" ); $y= %Vendors<ContactName>; say $y;'
Type check failed in assignment to $y; expected Str but got Any (Any)
    in block <unit> at -e line 1


$ p6 'my $x = "acme"; my Str $y; my %Vendors = ( acme => ContactName =>
"Larry" ); $y= %Vendors<ContactName>.Str; say $y;'
Use of uninitialized value of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to
something meaningful.
    in block <unit> at -e line 1


Many thanks,
-T

Figured out my booboo. I had to change from

     $PartsStr =
        "Hi $Manager,<br><br>" ~
        "Account Number: <b>$AccountNo</b><br><br>" ~

to

     $PartsStr =
        "Hi " ~ $Manager ~ ",<br><br>" ~
        "Account Number: <b>" ~ $AccountNo ~ "</b><br><br>" ~


Thank you!

Reply via email to