Brian Gruber wrote:
> 
> Hello,

Hello,

> In the midst of learning perl, I was messing around with stuff, and I
> found the following behavior to be a bit confusing.  For some reason,
> I seem to be unable to cat a \u or \l for that matter with another
> string using the . operator.  Other backslash-escaped characters
> (tabs, newlines etc.) work fine.  So for example:
> 
> $foo = "\u" . "bar";
> print $foo;  #or even print "$foo";
> 
> Prints "bar" and not "Bar".  on the other hand:
> 
> $foo = "bar";
> print "\u$foo";
> 
> works as expected.  i'm sure there's a good reason for this; could
> someone explain it to me?

The strings are interpolated (evaluated) before the concatenation is
performed.  "\u" becomes "" before the strings are joined together.

$ perl -MO=Deparse -e'print "\u" . "bar"'
print 'bar';
-e syntax OK


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to