Repository navigation
Replies: 3 comments
|
Hi @2colours , the error I'm getting is "cannot assign to a read-only variable or value": ~$ cat ~/key_test_4_bruce.txt
1 KEY2
2 VAL21
3 VAL22
4 VAL23
5 VAL24Now conventional sigil (works fine): ~$ raku -ne 'my ($k, $v) = .split: "\t"; say $k => $v;' ~/key_test_4_bruce.txt
1 => KEY2
2 => VAL21
3 => VAL22
4 => VAL23
5 => VAL24Now with "sigil-less" variables: ~$ raku -ne 'my (\k, \v) = .split: "\t"; say \k => \v;' ~/key_test_4_bruce.txt
\("k" => \("KEY2"))
Cannot assign to a readonly variable or a value
in block <unit> at -e line 1Note: I tried hinting the compiler by adding a numeric parameter to |
0 replies
|
Hi @jubilatious1 , I can't see here where you are doing anything that involves sigilless variables without destructuring - the |
0 replies
|
Hi @2colours Let me try that: % raku -ne 'my (\k, \v) = .split: "\t"; say \k , \v;' ~/key_test_4_bruce.txt
\("1")\("KEY2")
Cannot assign to a readonly variable or a value
in block <unit> at -e line 1
% raku -ne 'my \k = .split: "\t"; say \k ;' ~/key_test_4_bruce.txt
\(("1", "KEY2").Seq)
\(("2", "VAL21").Seq)
\(("3", "VAL22").Seq)
\(("4", "VAL23").Seq)
\(("5", "VAL24").Seq)
% raku -ne 'my \k = .split("\t").List; say \k ;' ~/key_test_4_bruce.txt
\(("1", "KEY2"))
\(("2", "VAL21"))
\(("3", "VAL22"))
\(("4", "VAL23"))
\(("5", "VAL24"))
% raku -ne 'my (\k,\v) = .split("\t").List; say \k,\v ;' ~/key_test_4_bruce.txt
\("1")\("KEY2")
Cannot assign to a readonly variable or a value
in block <unit> at -e line 1 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This is just a cheap way for me to add a quick note: the binding issue seems to be tied to destructuring in particular;
my \k = .split: "|";will work just fine,my (\k, \l) = .split: "|";will cause problems.PS: By the way, could the Github Discussions tab turned on for this repo? It's probably simpler for adding notes like this than fully blown issues.
All reactions