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:


# print "Display = " + %*ENV{'DISPALY'} + "\n";
print "Perl Version = " + $*PERL + "\n";

$ ./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,

On 01/13/2017 01:27 AM, Siavash wrote:

`+` is addition operator:

String concatenation operator is `~`:

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>"

Thank you!

Computers are like air conditioners.
They malfunction when you open windows

Reply via email to