in reply to Function call inside qq//
In addition to the 'pram' operator (also known as the Baby Cart From Hell operator), there's something like:
c:\@Work\Perl\monks>perl -wMstrict -le "sub stars { return \ ('*' x $_[0]); } ;; my $str = qq{foo-${ stars(5) }-bar}; print qq{'$str'}; " 'foo-*****-bar'
But why bother? Just use good old sprintf; that's what it's there for.
c:\@Work\Perl\monks>perl -wMstrict -le "sub stars { return '*' x $_[0]; } ;; my $str = sprintf 'foo%s%sbar', stars(5), '=' x 7; print qq{'$str'}; " 'foo*****=======bar'
Update: Added sprintf example, Baby Cart WP link.
|
|---|