New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
%hash«$key»:exists is true allways #6089
Comments
From jarkko@bansu.fiEXAMPLE: OUTPUT: EXPECTED RESULT: FROM #perl6 CHANNEL: VERSION INFORMATION $ uname -a Best regards, -- |
From @zoffixznetOn Tue, 21 Feb 2017 05:15:56 -0800, jarkko@bansu.fi wrote:
Thank you for the report. There was a discussion[^1] on the topic later on that clarified what The interpolation syntax you're using doesn't just interpolate the variable's <Zoffix> m: my $x = 'a b'; dd «$x» The result is a slip, so that at the end you end up with a nice flat list: <Zoffix> m: my $x = 'a b'; dd «$x $x» You always get a slip from just «$x», regardless of whether it ends up <Zoffix> m: my $x = 'a'; dd «$x» And if you do meant for the variable to be interpolated as just <Zoffix> m: my $x = 'a b'; dd «"$x"» So now, if we circle back to the original code: %hash«$key»:exists { say "why i'm here" }; It will always succeed, as long as $key is not an empty string, because you're always The correct syntax you're looking for is: %hash{$key}:exists { say "why i'm here" }; That way you're passing whatever is in $key literally; so this is the way to refer to object <Zoffix> m: my %h := :{ 42 => 'foo' }; say %h{42} # make a Hash with Int keys, give Int when looking up key Cheers, |
The RT System itself - Status changed from 'new' to 'open' |
@zoffixznet - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#130827 (status was 'rejected')
Searchable as RT130827$
The text was updated successfully, but these errors were encountered: