Hi,

`+` is addition operator:
https://docs.perl6.org/routine/$PLUS_SIGN#(Operators)_infix_+

String concatenation operator is `~`:
https://docs.perl6.org/routine/$TILDE#(Operators)_infix_~

So you should write:
print "Perl Version = " ~ $*PERL ~ "\n";

Or use `say` or `put` to add a newline:
say "Perl Version = $*PERL";

So for your commented line, you can write:
say "Display = %*ENV<DISPLAY>"

On 2017-01-13 09:01:32 GMT, Todd Chester wrote:
> Hi All,
>
> I am trying to understand how to read variables from the
> shell's environment.  I am reading this:
>
> https://docs.perl6.org/language/variables#Dynamic_variables
>
> <code>
> #!/usr/bin/perl6
> # print "Display = " + %*ENV{'DISPALY'} + "\n";
> print "Perl Version = " + $*PERL + "\n";
> </code>
>
>
> $ ./env.pl6
> Cannot resolve caller Numeric(Perl: ); none of these signatures match:
>      (Mu:U \v: *%_)
>    in block <unit> at ./env.pl6 line 3
>
>
> What am I missing?  I'd like to get the one I commented
> out on line 2 working too.  That gives me the following error:
>
> Use of uninitialized value of type Any in numeric context
>    in block <unit> at ./env.pl6 line 2
> Cannot convert string to number: base-10 number must begin with valid 
> digits or '.' in '⏏Display = ' (indicated by ⏏)
>    in block <unit> at ./env.pl6 line 2
>
>
> Many thanks,
> -T

Reply via email to