<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true">I manage a CentOS 5.10 server running perl 5.8.8. For <REASONS>, I can't upgrade it.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">For some reason, I can't install the XS version of Scalar::Util, and so I'm stuck using the PP version. Net::OpenSSH relies on Scalar::Util's dualvar function (which is only available in the XS version of Scalar::Util) to create a single scalar holding both an integer and string value. When the scalar is used in a numeric context, the integer value comes out, and when the scalar is used in a string context, the string value comes out. I'm trying to write a quick and dirty PP version of dualvar so I can move on with my life.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">I seem to remember seeing this being done, but no amount of googling is getting me there. I've looked up typeglobs and the *foo{THING} construct, but while THING can be SCALAR, it can't be NUMBER or STRING. Does anyone know the magic to make this happen?</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">I'm trying variations of the following:</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">my $int = 2;</div><div apple-content-edited="true">my $string = "test";</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">my $typeglob = $int;</div><div apple-content-edited="true">*typeglob{SCALAR} = ${ *string };</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">print ($typeglob + 2) . "\n";</div><div apple-content-edited="true">print $typeglob . " YES!\n";</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">It just feels gross, and it's not working.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">Does anyone have the magic?</div><div apple-content-edited="true"><br class="Apple-interchange-newline"><hr style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><table style="font-family: Helvetica; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><tbody><tr><td style="vertical-align: top; width: 70px; "><img width="70" height="69" src="http://cronin.dyndns.org/avatar.jpg" align="left" hspace="9" alt="Patrick's Avatar"></td><td><span style="font-family: Calibri; "><nobr><b><span style="color: rgb(31, 73, 125); font-size: 12pt; ">Patrick Cronin</span></b><span class="Apple-converted-space"> </span></nobr><br><span style="color: rgb(89, 89, 89); font-size: 10pt; "><nobr>Computer Lover</nobr><br><nobr>Mobile: +1 518 336 5133</nobr><br><nobr>Email:<span class="Apple-converted-space"> </span><a href="mailto:oshihuna@gmail.com">oshihuna@gmail.com</a><br>Skype: patrickcronin12061</nobr><span class="Apple-converted-space"> </span></span></span><span style="font-size: 8pt; color: green; "><br><br><span style="font-family: webdings; ">P</span><span class="Apple-converted-space"> </span><span style="font-family: arial; ">Please consider the environment before printing this e-mail / attachments</span><span class="Apple-converted-space"> </span>    </span><span class="Apple-converted-space"> </span></td></tr></tbody></table>
</div>
<br></body></html>