You're right, the post-interpolated line should read:
*main::scott = "scot2";
Here's what I've been using to test my assumptions:
#!/usr/bin/perl
$test1 = "value of test1";
$test2 = "test1";
$test3 = "Why are you here?";
# refers to *main::test1
print "=>$main::{$test2}<=\n";
print "Original \$test1: ...$test1...\n";
$main::{$test2} = "test3";
# $main::{"test1"} = "test1";
print "\$test1 = >>", $test1, "<<\n";
print "Main package: ", $main::test1, "\n";
As you can see, $main::{$test2} evaluates to a typeglob.
Saying that $main::{$test2} = "test3" changes the scalar is technically incorrect. (Though it is what my previous answer would lead one to believe!)
Dunno where that u came from. Maybe it's a mu?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.