package PACK; sub func { print "1\n"; } package main; $obj = bless {}, 'PACK'; $obj->func; $str = "$obj->func;1"; eval $str or print $@;
This sounds a lot like an XY Problem. Why are you trying to do a string eval, instead of just the code
If there's a reason to do a string eval, why aren't you escaping the dollar sigil in your original string, e.g.$dbh->do("CREATE TABLE STAIP08FK (PROBKEY varchar(20),MOBPAITS varchar +(15),SOLVER varchar(10),UNKNOWNS char(11),CONSTRAINTS char(11),OBJECT +IVE char(11),MODEL char(16),CRITERIA char(11),ITERATIONS integer,prim +ary key (PROBKEY) );"
$str = qq{\$dbh->do("CREATE TABLE STAIP08FK (PROBKEY varchar(20),MOBPA +ITS varchar(15),SOLVER varchar(10),UNKNOWNS char(11),CONSTRAINTS char +(11),OBJECTIVE char(11),MODEL char(16),CRITERIA char(11),ITERATIONS i +nteger,primary key (PROBKEY) );"};
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
In reply to Re: Eval error on connectd DBI handle
by kennethk
in thread Eval error on connectd DBI handle
by beartham
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |