在这段代码中,我想访问{IS-VAR}哈希数组中每个元素的键值@Cleared.当它进入内部时,循环$_被设置为值$_->{'NAME'}.
if (grep {$_->{'NAME'} eq $entity_name} @Cleared)
{
**$is_var = $_->{'IS-VAR'};**
$var_flag = 1 if ($is_var =~ /^TRUE$/i);
}
Run Code Online (Sandbox Code Playgroud)
有没有办法访问$_->{'IS-VAR'}循环内部的值,$_作为@Cleared此上下文中的元素?
结构@Cleared如下:
@Cleared = [NAME => 'xxx',
TYPE => 'yyy',
IS-VAR => 'TRUE'];
Run Code Online (Sandbox Code Playgroud) 我试图捕捉''部分,'<'和'>'符号内的内容可能会有所不同.它可能还包含一些点.所以我正在努力
String Inputstr = "SOME <Module Name> Module";
ptrn = Pattern.compile("<.*>", Pattern.DOTALL);
mtch = ptrn.matcher(Inputstr);
if (mtch.matches()) {
// Do a replacement operation
}
Run Code Online (Sandbox Code Playgroud)
但问题是它根本没有进入if条件.感谢帮助.