#!/usr/bin/perl -s -w my @array = qw (1 0&&1 0||1 45 45-45 45/45 45==45 $a=45 45<=>45); # last line reads in all the expressions to be tested into an array foreach (@array) { #this loop tests each of the expressions #eval($_) causes the execution/evaluation of the string stored in $_ if(eval($_)){ print "\($_\) is true \n"} else { print "\($_\) is false \n" }; };