[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Unexpected behavior from tr function



On Wed, 13 Oct 1999 08:23:49 -0400, schinder@pobox.com wrote:

>} Any ideas as to why $test=~tr/$_/$_/ doesn't work inside of a loop?
>
>Because the search list and replacement list are built at compile
>time, where $_ is undefined.

Heh?

	$test = 'a$b$c_d';
	print $test =~ tr/$_//;
-->
	3

	print $test =~ tr/_$//;
-->
	3

Same result. '$' and '_' are taken literally. There is NO interpolation
at all, not even at compile time. 

Perl can be confusing at times. :-)

-- 
	Bart.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org