On Fri, Jan 13, 2017 at 10:01 AM, Todd Chester <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> 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,

Fernando Santagata

On 01/13/2017 01:20 AM, Fernando Santagata wrote:

print "Perl Version = " ~ $*PERL ~ "\n";

or better:

say "Perl Version = $*PERL";


Hi Fernando,

That fixed it.  I was using Perl5's string concatenation.  Will "~"
always replace "+" for this, or only with a dynamic variable?

On line two, I misspelled "DISPLAY".

print "Display = " ~ %*ENV{'DISPLAY'} ~ "\n";
print "Perl Version = " ~ $*PERL ~ "\n";

Display = :0.0
Perl Version = Perl 6

Thank you!

Reply via email to