Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: How to pass a variable string as conditional argument to if statment

by poj (Abbot)
on Feb 06, 2016 at 07:00 UTC ( [id://1154544]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How to pass a variable string as conditional argument to if statment
in thread How to pass a variable string as conditional argument to if statment

Are you checking for errors after the eval ?

#!perl use strict; my @test = ('10>5','10<5','13+2==14+1','4>(6/2)+1'); for my $var (@test){ my $result = eval $var ? 'True' : 'False'; die $@ if $@; # check for errors in eval print "$var is $result\n"; }
poj
  • Comment on Re^5: How to pass a variable string as conditional argument to if statment
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1154544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-24 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found