开发者

Oneliner -a-switch - in Perl

开发者 https://www.devze.com 2023-03-21 07:30 出处:网络
Would it be theoretically possible to enable automatically the -a 开发者_如何学JAVAswitch if -n or -p is enabled and if in the code is a non declared @F array or a part of it?No, I don\'t think you ca

Would it be theoretically possible to enable automatically the -a 开发者_如何学JAVAswitch if -n or -p is enabled and if in the code is a non declared @F array or a part of it?


No, I don't think you can do this; -a, like -l, -n, and -p actually changes the code presented to the parser, long before you'd know if the code uses @F.


No. One-liners don't have to declare variables, and there could be some already out there that use an array named @F for something completely different. Perl 5 doesn't like to break backwards compatibility, especially for a savings of only one character (Perl allows you to bundle switches, like -an).

0

精彩评论

暂无评论...
验证码 换一张
取 消