How about this:

print $char x $number_of_chars . "\n"  for 1..$number_of_lines;



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Karl-Heinz Kuth
Sent: Monday, May 08, 2006 4:30 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Problem with print function

Hi,

I've got the following problem:

use strict;
use warnings;

my $char = "-";
my $number_of_lines = 3;
my $number_of_chars = 20;

print "This is the output I want: \n";
my $line = $char x $number_of_chars . "\n";
print $line x $number_of_lines, "\n";

# I do not want to use the var $line. So how to write
# it in one statement?
# My try isn't correct.
print "The output with 1 statement: \n";
print  $char x $number_of_chars . "\n"  x  $number_of_lines, "\n";

Regards
Karl-Heinz

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to