perl5.8

Can I make sure Perl code written on 5.10+ will run on 5.8?

本小妞迷上赌 提交于 2020-01-01 09:30:14
问题 Some of the new features of Perl 5.10 and 5.12, such as "say", are defined as features, that you can enable or disallow explicitly using the "feature" pragma. But other additions, like the named capture groups of regexes, are implicit. When I write Perl using a 5.10+ interpreter, but want it to also run on 5.8, can I make Perl complain about using anything that's not in 5.8? Obviously, it is good practice to test your code on all major versions you intend it to run on, but it'd still be nice

Can I make sure Perl code written on 5.10+ will run on 5.8?

淺唱寂寞╮ 提交于 2019-12-04 04:26:05
Some of the new features of Perl 5.10 and 5.12, such as "say", are defined as features, that you can enable or disallow explicitly using the "feature" pragma. But other additions, like the named capture groups of regexes, are implicit. When I write Perl using a 5.10+ interpreter, but want it to also run on 5.8, can I make Perl complain about using anything that's not in 5.8? Obviously, it is good practice to test your code on all major versions you intend it to run on, but it'd still be nice to have Perl warn me automatically. When I want to ensure that a program will run under particular

Matching balanced parenthesis in Perl regex

青春壹個敷衍的年華 提交于 2019-12-01 02:28:37
问题 I have an expression which I need to split and store in an array: aaa="bbb{ccc}ddd" { aa="bb,cc" { a="b", c="d" } }, aaa="bbb{}" { aa="b}b" }, aaa="bbb,ccc" It should look like this once split and stored in the array: aaa="bbb{ccc}ddd" { aa="bb,cc" { a="b", c="d" } } aaa="bbb{}" { aa="b}b" } aaa="bbb,ccc" I use Perl version 5.8 and could someone resolve this? 回答1: Use the perl module "Regexp::Common". It has a nice balanced parenthesis Regex that works well. # ASN.1 use Regexp::Common; $bp =