in reply to Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
It's important to know that simple string concatenation is more efficient, and often much easier to read.
An explicit join on space or $" is more efficient than using @{[]}."method result - ${ \$obj->method }\n"; "method result - " . $obj->method . "\n";
Easiest to read imho is (s)printf."foo @{[ some_list() ]}."; "foo ${\ join $", some_list() }"; "foo ${\ join ' ', some_list() }"; "foo " . join ' ', some_list();
printf "method result - %s\n", $obj->method;
The idiom is also explained in perlfaq4's How do I expand function calls in a string?.
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (2): Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
by VSarkiss (Monsignor) on Aug 21, 2003 at 17:57 UTC | |
Re^2: Perl Idioms Explained - ${\$obj->method} and @{[sort @list]}
by Aristotle (Chancellor) on Aug 24, 2003 at 07:40 UTC |
In Section
Meditations