develooper Front page | perl.perl6.language | Postings from March 2005

Re: A possible solution for s?pintf

Thread Previous | Thread Next
Matt Diephouse
March 12, 2005 20:08
Re: A possible solution for s?pintf
Message ID:
Brent 'Dax' Royal-Gordon <> wrote:
> Besides, I think "as" will do just fine, especially since you can now
> interpolate method calls as well.  You can even do something like this
> if you want to perform bulk formatting:
>     say join ' ', ($n1, $n2, $n3) >>.as('%d');

What about:

  say [ $n1, $n2, $n3 >>.as('%d') ].join;


Can I (1) use join on a bracketed list and (2) leave off the
parentheses around C<$n1, $n2, $n3>? (I couldn't find where hyper ops
are on the precedence table.)

> Or, if that's not quite sufficient:
>     say map { }
>         $num => '%d',
>         $str => '%s',
>         ...;

And this:

  say [ $num => '%d', $str => '%s' ] >>;


Can I (3) hyper-op chained method calls and (4) use square brackets in
this instance (to make sure my list doesn't form a parameter list to

matt diephouse

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About