That is pretty cool, but I had a few problems with it when I was trying to test it. It seemed to work fine with simple "Hello World" type programs, but as the programs that I tested got more complex, it began to fail. In case you want it, here is my "Result":
(08:38:11) : Can't locate object method "new" via package "Benchmark" (perhaps you forgot to load "Benchmark"?) at /var/www/basic/lib/WPLib.pm line 304.
I get that when trying to run the following: #!usr/bin/perl
I have tried to remove the strict module and all of my "my" statements, but nothing seems to work. Still, this seems to be a new project and I am sure that as time passes, more and more support will be available and more and more language functionality will be supported. I am pretty excited to see what this project will develop into. Thanks for the heads up!
sub main{ $count=0; print "Please enter a number [1..18] to continue\n:"; $x = <> if($x=~m/[0-9] / && $x<=20 && $x>0){foo();} elsif($x>20||$x<0){main();} else{exit 0;} }
I noticed an error or two in your perl, but it could just be me.
You've got an extra curly bracket ('}') at the end of the function definition for foo().
Also, the line below doesn't seem right. first, I think you need to use dollar signs instead of at symbols. Second, I think there's supposed to be an operation of some sort between "$y[($count-1)]" and "$y[($count-2)]".
Tim, you are completely correct on the second part (there is supposed to be a addition sign in there). There is some other code that is cut as well, but this is actually a working Perl script when completely intact. All it does is find the first >i>n numbers of the Fibonacci sequence where the user inputs n, but when I can manage to get the code together, it does work. =) The @ is just the list and the [blah] is an element of that list. I was just playing around by writing it that way. It is mostly all out of whack b/c I am giving this to my interviewees(sp?) to hand trace as one of my tests / interview questions for the positions that I am hiring for. I want to make sure that they can hand trace code, so I have bad names for the vars and some strange notation (as well as no comments) to try to throw them off and at least challenge them slightly. If you want the complete code, though, I would be happy to mail the correct .pl file to you.