Well, that makes it pretty clear: your problem is in the code you didn't show us; the part by which you obtain and generate the scalars! (possibly need to chomp?)
check Ln42
Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
code
verbatim error and/or warning messages
a coherent explanation of what "doesn't work actually means.