in reply to Perl Help

You really need to make an attempt at it and explain what parts you are having difficulty understanding.

Here's one way not to do it.

@ops = (" +", " *"); $$_=$| for $ops[$| = 1]; while ((sqrt(@foo)-atan2(0,-1))=~/[^\d.]/) { print "Feed me, Seymour: "; @foo = (splice(@foo, 0), split " ", join("\n", <STDIN> =~ /(?=-?\d).+?(?=\D|\z)/g), $_) for 9-$#foo; } grep {eval(qq!\${"!.$ops[$|--].qq<"}>.$ops[eval '--$|']. qq!=(@{[--$|]},@{[splice(@foo,0,1)]})\n!)} 0..9; print "$_: ", $$_, "\n" for @ops;
Note that the eval is purposefully insecure and can process unfiltered user input.