my $text = "(a + 13) * (b - 10 ) / c";
# select all individual alpha characters
my @vars = ($text =~ /[a-zA-Z]/g);
# get uniques out of the array
my %hash;
map { $hash{$_}++ } @vars;
my @unique_vars = keys %hash;
Of course, this solution is based on the assumption that your variables are always going to be a single a-z character (based on your example). Also, a small side-benefit of this code is that the values of
%hash will tell you how many times a particular variable was found in the equation.
---
It's all fine and dandy until someone has to look at the code.