kvale provides a point well taken. Still, the relevance or need for quotes around a variable name actually depend on the context -- we'd need to see the code where $userid is actually being assigned to and used, to tell whether the use of quotes is really necessary. As a rule, I think Perl normally does the right thing with strings consisting of many digits. Consider:
$s1 = "01234567891233456789"; $s2 = "012345.6789123456789"; $n1 = $s1+1; $n2 = $s2+1; $c1 = $s1; $c2 = $s2; print "$n1 == $s1 + 1\n"; print "$n2 == $s2 + 1\n"; print "$c1 eq $s1\n"; print "$c2 eq $s2\n"; __OUTPUT__ 1.23456789123346e+18 == 01234567891233456789 + 1 12346.6789123457 == 012345.6789123456789 + 1 01234567891233456789 eq 01234567891233456789 012345.6789123456789 eq 012345.6789123456789
The assignments to $n1 and $n2, happening in numeric context, cause a loss of precision -- as well as removal of leading zeros, but using $s1 and $s2 in a numeric context does not cause a change in the string value that was originally assigned to these variables: if a variable is originally assigned a value in a string context, it will always return that value when used in a string context.

The other thing to note is that the "default" value assignment operation is a string assignment, unless rhs variable's original value was obtained/created in a numeric context.


In reply to Re: "force string context"? by graff
in thread "force string context"? by bronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.