sub get_proparg { my $propstr = shift; # get the property string my $level = shift || return $propstr; # get the level we want to extract my $cnt; # initialize counter if($level == -1) { # special case, get the innermost argument $propstr =~ /\(([^\(\)]+)\)+/; return $1; } else { # get whatever argument $level indicates for($cnt = 0;$cnt<$level; $cnt++) { $propstr =~ /\((.+)\)/; $propstr = $1; } return $propstr; } }