- 论坛徽章:
- 1
|
我理解+(split)[4] 写全了就是 scalar((split /\s+/, $_)[4])
你可以看一下 perldoc -f print
print LIST
Because print takes a LIST, anything in the LIST is evaluated in list context, and any subroutine that you call will have one or more of its expressions evaluated in list context.
+号作用类似scalar函数
ls -lAF | perl -e 'while (<>) { next if /^[dt]/; print scalar((split /\s+/, $_)[4]),"\n" }'
print结果的时候插入一个函数也可以用一个匿名数组[...]中调用函数,然后@{}来解除引用。
ls -lAF | perl -e 'while (<>) { next if /^[dt]/; print "@{[(split /\s+/, $_)[4]]}\n" }'
|
|