That would produce the output with $VAR1 and $VAR2 you've shows in the question.
Now if you want to search for the data structure inside @all_results where the key uniqueID is "green", you can use grep to look into every data structure, and filter out only the one you want.
Note that you need the parentheses () around the new variable, as grep returns a list. You need to assign in list context, otherwise you'll get the number of elements of the result back. (That's 1 in this case).
发布评论
评论(1)
看来您有数据结构列表,您将传递给Data :: Dumper。
这将用
$ var1
和$ var2
产生输出。现在,如果要搜索
@all_results
中的数据结构,其中keyunique
is是
“ green”
,您可以使用grep
查看每个数据结构,并仅过滤您想要的一个。请注意,您需要括号
()
围绕新变量,因为grep
返回列表。您需要在列表上下文中分配,否则您将获得结果的元素数量。 (在这种情况下是1
)。以上代码的输出是
It looks like you have a list of data structures, that you are passing to Data::Dumper.
That would produce the output with
$VAR1
and$VAR2
you've shows in the question.Now if you want to search for the data structure inside
@all_results
where the keyuniqueID
is"green"
, you can usegrep
to look into every data structure, and filter out only the one you want.Note that you need the parentheses
()
around the new variable, asgrep
returns a list. You need to assign in list context, otherwise you'll get the number of elements of the result back. (That's1
in this case).The output of above code is