Sure. Suppose noob comes up to his screen with a program that isn't working right:
#!/usr/bin/perl
for ($i=0,$i<=5,$i++)
{
print "FOO\n";
}
which prints:
FOO
FOO
FOO
no matter what he does. (classic newbie mistake that used to bug me when I was doing C :) He checks a box that says "output is incorrect."
Our critter will extract the for() loop from his code, and wrap it in :
eval
{
for (i=0,$i<=5,$i++)
{
print "FOO\n";
}
};
print "'$@'";
This tells our critter that the code did execute. It's next step is to examine node replies for similar code fragments. Pretty soon (!), it discovers that a for() loop should have ';' instead of ',' as iterator separators, and hands back the code:
#!/usr/bin/perl
for ($i=0;$i<=5;$i++)
{
print "FOO\n";
}
A further refinement would have it make a scope declaration pass, and hand back:
#!/usr/bin/perl
use strict;
use warnings;
for (my $i=0;$i<=5;$i++)
{
print "FOO\n";
}
|