Uri Guttman:
# >>>>> "BD" == Brent Dax <[EMAIL PROTECTED]> writes:
#
#   BD> I think qn counts as weird syntax.  I ask again, what's
# wrong with one
#   BD> of:
#
#   BD>         sprintf("%hash\%s", $string);
#
#   BD>         sprintf(%hash.'%s', $string);
#   BD>         sprintf('%s%s', _%hash, $string);
#
# what if you want to use %hash{width} as a field precision? i
# don't like
# the idea that all format specifiers would be the noisy \%s. they are
# much more common than using hashes in format strings. now as i said in
# another post, you can use the * method but i never liked it.
# in c it was
# the only decent solution to dynamic precisions (other than doing a
# sprint of the format string itself which loses). in perl,
# interpolation
# makes that easier but i have rarely seen hashes used in that
# way. a temp
# variable is as good a solution for that too.
#
# $prec = %hash{width} ;
# sprintf( qf"%${prec}s", $string);
#
# sprintf( "\%${prec}s", $string);
#
# is one of your alternatives. :-/

You forgot one.

        sprintf('%'_%hash{width}_'s', $string);

Not horribly pretty, true, but not bad enough to justify writing a
quoting hack into the language.  (And yes, I do consider 'qf' a quoting
hack.)

--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

#define private public
    --Spotted in a C++ program just before a #include

Reply via email to