#!/usr/bin/perl -w
use strict;
while (my $righteq = ) {
my @remaining = $righteq =~ /([a-z]\^(?:[a-z]|\([a-z][+-]\d+(?:\.\d+)?\)))/g;
print '$remaining[',$_,'] is ',$remaining[$_],$/ for 0..$#remaining;
}
__DATA__
+++-+++t^n+++f^n+e^(t-123.22)
t^n+--++-+f^n++e^(t-123.22)++
+++++---+t^n+f^n+++e^(t-123.22)-
##```
##
$remaining[0] is t^n
$remaining[1] is f^n
$remaining[2] is e^(t-123.22)
$remaining[0] is t^n
$remaining[1] is f^n
$remaining[2] is e^(t-123.22)
$remaining[0] is t^n
$remaining[1] is f^n
$remaining[2] is e^(t-123.22)
```