I
Ignoramus28164
I wrote a perl based algebra expression simplifier with work shown.
http://www.algebra.com/services/rendering/simplifier.mpl
It uses deeply nested structures of hashes holding references to
arrays.
Example:
my $term = { factors => [ $factor1, $factor2], operator => '+' };
I often need to get, say, the quantity of item in array held by the
hash.
I do it like this:
my $factors = $term->{factors};
print "Count = " . $#$factors . ".\n";
Unfortunately, this infolves creation of a temporary variable. Can I
avoid using a temporary?
Also, how can I access an element by number, instead of using
$$factors[0], can I say something like @($term->{factors})[0] or some
such, without using a temporary variable.
thanks
i
http://www.algebra.com/services/rendering/simplifier.mpl
It uses deeply nested structures of hashes holding references to
arrays.
Example:
my $term = { factors => [ $factor1, $factor2], operator => '+' };
I often need to get, say, the quantity of item in array held by the
hash.
I do it like this:
my $factors = $term->{factors};
print "Count = " . $#$factors . ".\n";
Unfortunately, this infolves creation of a temporary variable. Can I
avoid using a temporary?
Also, how can I access an element by number, instead of using
$$factors[0], can I say something like @($term->{factors})[0] or some
such, without using a temporary variable.
thanks
i