# Get the n-th or innermost (if n = -1) argument of # property. Empty string if property isn't parametrized sub get_proparg { my $propstr = shift; # get the property string my $level = shift || 0; # get the level we want to extract my $back = $propstr; # Initialize Return value (for case level=0) my $cnt; # initialize counter if($level == -1) { # special case, get the innermost argument $propstr =~ /\(([^\(\)]+)\)+/; $propstr = $1; } else { # get whatever argument $level indicates for($cnt = 0;$cnt<$level; $cnt++) { $propstr =~ /\((.+)\)/; $propstr = $1; } } return $propstr; }