Hi Guys,
I'm writing a perl program to get an array of numbers/charaters and add the number but when the character "q" or "Q" if received it should exit.
print "Enter a array of any number of elements \n"; @x=<>; chomp @a; print "@x \n"; foreach(@x) { if(($_>0)&&($_<21)) { $y+=$_; print "Inside sum logic $_\n"; } elsif(($_ eq "q")||($_ eq "Q")) { print "Inside last $_ \n"; last; } }
but for some reason i don't see my check for "q" or "Q" getting true! Can somebody suggest what could be the problem?
Thanks :)
In reply to simple perl program not working by heman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |