Perl哈希键的合法值 [英] Legal values for Perl hash key
本文介绍了Perl哈希键的合法值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试重用我们内部提供的库函数,但是由于输入中的新变体,导致某些东西无法正常工作并引发错误.
I'm trying to reuse a library function we have in house, but due to new variants in my input things are not working right and throwing errors.
我意识到问题在于它现在正试图将一个时髦的句子分配为哈希键(例如下面的键列表),并且您可能会不喜欢它.有没有一种方法可以在对它进行哈希处理之前对其进行编码,以防止Perl产生任何干扰?
I realise the problem is that it is now trying to assign a funky sentence as the hash key such as the below list of keys and as you might expect, it's not liking it. Is there a way I can encode this before hashing it to prevent any sort of gag from Perl?
Document: Multiple Attribute Equals (#root3 #form input[type=hidden], #root3 #form input[type=radio])
Document: Attribute selector using UTF8 (#root3 span[lang=ä¸æ–‡])
Document: Attribute Ends With (#root3 a[href $= 'org/'])
Document: Attribute Contains (#root3 a[href *= 'google'])
Document: Select options via [selected] (#root3 #select1 option[selected])
Document: Select options via [selected] (#root3 #select2 option[selected])
Document: Select options via [selected] (#root3 #select3 option[selected])
Document: Grouped Form Elements (#root3 input[name='foo[bar]'])
Document: :not() Existing attribute (#root3 #form select:not([multiple]))
Document: :not() Equals attribute (#root3 #form select:not([name=select1]))
推荐答案
允许使用任何字符串.不是字符串的任何内容都将首先被字符串化.
Any string is allowed. Anything that's not a string will be stringified first.
这篇关于Perl哈希键的合法值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文