On 12/12/06, Daniel Pittman <[email protected]> wrote:
Robert Rothenberg <[email protected]> writes: > On 11/12/06 23:12 Peter da Silva wrote: >>>> One reason I'm down on Perl is that an awful lot of stuff that >>>> I find hateful in the shell is stuff that Larry Wall faithfully >>>> replicated in Perl.... >> >>> Such as? >> >> The things I mentioned several messages back, most expecially the ad-hoc >> syntax and complex macro-style variable substitution. > > What's complex about it? I *wish* Perl had complex macro-style variable > substitution.This is simple: format "~A ~A ~A" a-string an-array a-hash This is complex: print "$astring, @anarray, %ahash" Well, in fairness, this is actually the relative complexity: print "$astring, an array of length ", (scalar @anarray), "a hash with ", (scalar keys %ahash), "elements." ...or, worse, this: eval format "~S" an-array compared to this: string = '(' . join(', ', @anarray), ')' eval string
This is all very confusing to me. The examples dont do the same thing at all.
...assuming that you have only simple scalars in @anarray; if you don't the second example fails miserably.
So then you wanted: use Data::Dumper; $string=Dumper(\...@array);
Perl suffers from wanting to be any number of things, and by adding extra complexity and indirection to achieve it. It guesses what you want. It has stupid interpolation defaults, but you can't bypass them.
Ah, what? $"="whatever array seperator i choose"; $,="whatever print argument seperator i choose";
It has a crazy level of complexity, well beyond anything useful, in the way you can describe variables and pass them to, say, a formatted output generator.
Still confused here. How is the behaviour complex again? About the only hateful thing in this I can think of is that $" applies inside of qr// type constructs. It would be so nice if there was some other var for that scenario and that it would default to '|' Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"
