On Jul 25, Jeff 'japhy/Marillion' Pinyan said:
>On Jul 25, Silvio Luis Leite Santana said:
>
>>When I write
>>
>>*PI = 5;
>>
>>What am I really doing?
>
>Well, you can assign a string to a typeglob, and Perl will assume that you
>meant to assign a typeglob to a typeglob:
>
> *first = *1;
> "japhy" =~ /([aeiou])/;
> print "$first\n"; # prints 'a'
Let me explain a little more fully: EVERY '1' variable now has an alias
in a 'first' variable:
*first = 1; # is like *first = *1
push @1, "foo";
print $first[0]; # 'foo';
push @first, "bar";
print $1[1]; # 'bar';
$1{abc} = 'def';
print $first{abc}; # 'def'
$first{gh} = 'ij';
print $first{gh}; # 'ij'
# and so on...
You might want to read:
http://www.pobox.com/~japhy/articles/pm/2000-03.html
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]