3
在球拍方案中,有一個名爲「串口」的數據結構,您可以從中讀取數據。在perl6中有類似的東西嗎?對於例子,我要實現這些目標:perl6與讀取數據的球拍計劃類似的任何字符串端口?
my $a = "(1,2,3,4,5)"; # if you read from $a, you get a list that you can use;
my $aList=readStringPort($a);
say $aList.WHAT; # (List)
say $aList.elems; # 5 elements
my $b = "[1,2,3]"; # you get an array to use if you read from it;
my $c = "sub ($one) {say $one;}";
$c("Big Bang"); # says Big Bang
功能EVAL倒不做任務的全譜:
> EVAL "1,2,3"
(1 2 3)
> my $a = EVAL "1,2,3"
(1 2 3)
> $a.WHAT
(List)
> my $b = EVAL "sub ($one) {say $one;}";
===SORRY!=== Error while compiling:
Variable '$one' is not declared. Did you mean '&one'?
------> my $b = EVAL "sub (⏏$one) {say $one;}";
非常感謝!
lisprog
我明白了!我現在明白了。謝謝你! – lisprogtor