Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Apart from that using placeholders is almost certainly the way to go, I think that your reasoning is slightly flawed. Either you know that this $var contains the value that is maintained as a string field, or you don't. Perl doesn't store the quotes internally and whenever you load a variable, the initial value of the variable is always a string. It doesn't get converted to its binary form until you use it in a numeric context, at which point perl will convert the ascii representation to the binary numeric form. If you then imediately use it in a string context, perl will convert it back. Any simple test you tried to apply for either form is going to always be true because perl will supply the form you are asking for. You don't say at which point in the process you are trying to make the determination. When you are writing it to the text file, or when you read it back? In the former case, you should be able to determine the type of the field from the table schema. In the latter case, assuming you wrote the string quoted, you could simply not strip them off when you read the file in, and then you would know which was which. ie.
HTH? In reply to Re: Re: Test for number or string
by Anonymous Monk
|
|