[Chicago-talk] Doing "-X" tests in a loop

Jay Strauss me at heyjay.com
Tue Oct 6 09:17:56 PDT 2009


How would I do "-X" test in a loop?  I've been trying variations on eval,
but can't get it to work:

        foreach (qw[-e -r -s]) {

            eval "$error = $_ unless $_ $xopt{data_file}";
            print "$_: $error\n";

but $error doesn't change if any of the tests fail

Obviously my "eval" is wrong but I've tried it a bunch of different ways and
cant get it work.

Could someone point me in the right direction?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20091006/36493332/attachment.html>

More information about the Chicago-talk mailing list