develooper Front page | perl.perl6.language | Postings from April 2001

Re: Strings vs Numbers (Re: Tying & Overloading)

From:
Bart Lateur
Date:
April 23, 2001 13:28
Subject:
Re: Strings vs Numbers (Re: Tying & Overloading)
Message ID:
6k39et0o575cpuhgq7ahssfugronser0k9@4ax.com
On Mon, 23 Apr 2001 16:14:50 -0400, John Siracusa wrote:

>Using + for concat: no!
>
>My vote is to use . and require space before and after.
>$this.$is.$ugly.$anyway ;)

My vote is to ditch the concat operator altogether. Hey, we have
interpolation!

	"$this$is$just$as$ugly$but$it$works"

Which reminds me... one problem I have with it is that it's too hard to
separate a variable name from the rest of the string, if it also
consists of word characters:

	my $bar = "BAR";
	print "foo${bar}baz";  -> fooBARbaz

Since $bar is a lexical variable, this syntax doesn't make much sense
anyway: it reeks of symbolic references and those don't work for
lexicals.

I think I'd like something incorporating a backslash would be nicer:

	print "foo$bar\Ebaz";

It works, but it may have unwanted side effects -- in case the "\E"
actually serves a purpose.

But, you may completely forget about it. I just had to say this one day.

-- 
	Bart.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About