Hi, I have a problem where a number read from a file is being treated as a string by perl (I think!). I am using the module RSPerl which is an interface between Perl and the statistical language R. When i read a column of numbers from a file and pass it to the perl/R function i get an "invalid 'type' (character) of argument" error.
The reason i think this is a problem on the Perl side is shown by this pseudocode: while(<FILE>){ ... stuff to extract $value from each row ... push(@list1, $value); } @list2 = (100.2, 232.333, 344.2); # these are the numbers from file my_R_func_call([EMAIL PROTECTED]); my_R_func_call([EMAIL PROTECTED]); using @list1 gives the error, @list2 does not. if i add a line that performs a redundant mathematical operation on $value before push'ing it into @list1 eg if($value < 1000000000000){} push(@list1, $value); then the error goes away, therefore i suspect this is a problem with the internal datatype. I have never worried about this in Perl before, but it appears to be more important now as R is more strict. is there a way in Perl to force a variable to be a number rather than a string? thanks adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.