小编lis*_*tor的帖子

为什么perl6不能只是autovivify,所以我不必一直使用"我的"?

在per5中,我可以使用变量,例如$ foo或@bar而不使用"my".

$foo=1; @bar=(1,2);
Run Code Online (Sandbox Code Playgroud)

在perl6中,为什么我必须一直使用"我的"?否则编译器会说变量unclared.为什么perl6不能只是autovivify?

print "{my @a=1,2,3;}\n"; # have to use "my" to declare variable
print "{@a=1,2,3;}\n"; # this is error 'Variable '@a' is not declared'
Run Code Online (Sandbox Code Playgroud)

我不喜欢必须总是使用"我的"的限制.这个级别太低了,比如C; 非常麻烦.

有没有办法打开始终自动生成?

谢谢.

variables declare perl6

3
推荐指数
1
解决办法
96
查看次数

如何自动下载由javascript控制的多个链接?

我需要从富国银行下载我公司 2015 年的所有 30 个银行账户月结单。富国银行现在允许客户执行以下操作:

(1) 点击“声明与披露”

(2) 点击“选择账户”

(3) 点击“查看时间段”

(4) 点击我要下载的月份的pdf文件

(5) pdf在浏览器上加载

(6)点击打开的pdf上的下载按钮

(7)点击保存

(8) 点击返回按钮下载下个月的结单

这太乏味并且太耗时。我使用 FireFox,FireFox 有一个名为“Down Them All”的附加组件。该插件适用于常规链接。但是,当我将鼠标指针悬停在富国银行月度报表的链接上时,这些链接似乎会转到“javascript:{0}”或类似的代码,并且“全部下载”无法找到这些链接。

还有其他方法可以批量下载吗?

非常感谢您的帮助 !!

利斯普罗格M

javascript batch-file download

2
推荐指数
1
解决办法
4019
查看次数

perl6如何仅在某些条件下匹配角色?

我有一个格式的文件:

- foo bar - baz
  one two three - or four
  and another line

- next job
  do this - and that
Run Code Online (Sandbox Code Playgroud)

我的语法是

grammar tasks {
    regex TOP        { \n* <oneTask>+ \n* }
    regex oneTask    { ^^ \- (<oneSection> <endSection>)+ }
    regex oneSection { \N+ } # this is not quite working
    regex endSection { \n+ }
Run Code Online (Sandbox Code Playgroud)

}

在正则表达式oneSection中,我如何编写"我想匹配' - '只有当它不在一行开头时"的事实?

我把文件放入一个字符串并解析这个字符串:

my $content = slurp("taskFile");
my $result = tasks.parse($content);
Run Code Online (Sandbox Code Playgroud)

这不太合适.

<[\N] - [\-]> does not make the match …
Run Code Online (Sandbox Code Playgroud)

regex match perl6 conditional-statements

2
推荐指数
1
解决办法
148
查看次数

perl6将运算符作为参数传递

我试图通过定义和传递原始运算符来实现类似于Scheme的一些功能.在Scheme中,你可以

(define x +) (x 1 2)
Run Code Online (Sandbox Code Playgroud)

并且此操作将给出答案3.在perl6中,我不得不将操作符放在另一个函数中以实现相同的操作:

sub x($a) { $a * 2; }
sub y($m, $n) { $m($n); }
say y(&x, 3); # gives you 6
say y(+, 3) # this is error
Run Code Online (Sandbox Code Playgroud)

是否有一种简单的方法来传递运算符和函数?

谢谢.

parameters arguments operators perl6

2
推荐指数
1
解决办法
128
查看次数