in reply to Re: How would you solve a user-inputted simple one-variable Linear Equation
in thread How would you solve a user-inputted simple one-variable Linear Equation

die "Not supported.\n" if /[^-+0-9x]/;

To avoid  Use of uninitialized value $_ in pattern match (m//) at ... I think this should be
    die "Not supported.\n" if $eq =~ /[^-+0-9x()]/;
or maybe better
    die "Not supported: '$1' \n" if $eq =~ /([^-+0-9x()]+)/;
(both tested).


Give a man a fish:  <%-(-(-(-<

Replies are listed 'Best First'.
Re^3: How would you solve a user-inputted simple one-variable Linear Equation
by hdb (Monsignor) on Apr 26, 2015 at 07:03 UTC

    Many thanks! I changed the code accordingly.