in reply to Perl Help
Here's one way not to do it.
Note that the eval is purposefully insecure and can process unfiltered user input.@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;
|
|---|