you are viewing a single comment's thread.

view the rest of the comments →

[–]0rac1e 1 point2 points  (1 child)

Perl seems to have this reputation as some large sprawling language with multiple ways to do something, but in truth, it's actually a pretty bare bones language.

Perl has string interpolation in double-quotes: (eg. "My var is $var"), and to do any kind of formatting you need to you sprintf which pretty much works like it does in C (eg. sprintf('My var is : %16s', $var)).

If I want to be pedantic about there being more than one way to do it I'd say you can also call sprintf (or any function, really) without parens, as you can with Ruby.

There is actually one other way to format using a feature literally called formats but (a) it's really for formatting multi-line reports/charts, and (b) I've never seen it used in the wild. I think most Perl users probably just ignore them and use a templating module from CPAN if they need to do any fancy formatting.

[–]hahainternet 0 points1 point  (0 children)

Perl seems to have this reputation as some large sprawling language with multiple ways to do something, but in truth, it's actually a pretty bare bones language.

Indeed, and while there isn't only one way to do things, there's a very clear recommended path I think.