[Israel.pm] A question of style - print()
Gaal Yahas
gaal at forum2.org
Wed Oct 19 05:06:26 PDT 2005
On Wed, Oct 19, 2005 at 01:36:33PM +0200, Madani, Srikanth, VF-DE wrote:
> I guess the only case where this construct will not be the optimal one
> is when I wish to print text on a single line on STDOUT (or whereever),
> but this text is wrapped inside the script (because of identation, Perl
> keywords like print etc.) and I would like to format it better. Here's
> an example of code, where my desired on-screen output is:
>
> ./temp.pl generates a version specific core domain change report from
> the appropriate synchronization log file.
>
> (It fits all on one line)
You may want to replace "print" with a wrapper that removes whitespace
and reformats the output to the correct width (something like the unix
command fmt maybe?). Then you can call my_print << "..." and be happy.
> I wasn't able to try the Perl 6 example.
There are easy ways to install pugs and run Perl 6 today:
* Windows: PxPerl <http://pxperl.com/>
* Debian: apt-get install pugs
* Gentoo: emerge pugs
This is not likely to be useful in a production environment yet, but is
very nice if you want to play around and get a sneak peek.
--
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
More information about the Perl
mailing list