Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Trailing Spaces -- Format Perl

Reply
Thread Tools

Trailing Spaces -- Format Perl

 
 
KVN Chary
Guest
Posts: n/a
 
      09-29-2004
Hello,

my $var1 = "temp";
my $var2 = "123";
my $space = " ";

format STDOUT =
@<<<<<<<<< @<<< @<<<<<<<<<<<<<<<<<<<<<<<<<
$var1,$var2,$space
..

I need to put 26 spaces at the end of line. But this code doesn't work?
How can I do this using FORMAT Perl Command?

Thanks
KVN
 
Reply With Quote
 
 
 
 
John W. Krahn
Guest
Posts: n/a
 
      09-29-2004
KVN Chary wrote:
>
> my $var1 = "temp";
> my $var2 = "123";
> my $space = " ";
>
> format STDOUT =
> @<<<<<<<<< @<<< @<<<<<<<<<<<<<<<<<<<<<<<<<
> $var1,$var2,$space
> .
>
> I need to put 26 spaces at the end of line. But this code doesn't work?
> How can I do this using FORMAT Perl Command?


Are you sure that you need to use format?

formline '@<<<<<<<<< @<<< @<<<<<<<<<<<<<<<<<<<<<<<<<', $var1, $var2, $space;

print STDOUT pack 'A42', $^A;



John
--
use Perl;
program
fulfillment
 
Reply With Quote
 
 
 
 
Billy N. Patton
Guest
Posts: n/a
 
      09-29-2004
KVN Chary wrote:
> Hello,
>
> my $var1 = "temp";
> my $var2 = "123";
> my $space = " ";
>
> format STDOUT =
> @<<<<<<<<< @<<< @<<<<<<<<<<<<<<<<<<<<<<<<<
> $var1,$var2,$space
> .
>
> I need to put 26 spaces at the end of line. But this code doesn't work?
> How can I do this using FORMAT Perl Command?
>
> Thanks
> KVN


You might try:
printf "%-8s %-3s ",$var1,$var2
print ' ' x 26 , "\n";

--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      09-30-2004
KVN Chary wrote:

> I need to put 26 spaces at the end of line.


Have you considered: $space = ' ' x 26;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSD to allow A-Z 0-9 and spaces, but not leading/trailing spaces johkar XML 2 12-10-2009 09:24 AM
Re: How to trim a String trailing spaces, but not leading spaces? Roedy Green Java 3 09-14-2008 02:10 AM
Re: How to trim a String trailing spaces, but not leading spaces? John B. Matthews Java 4 09-12-2008 05:28 AM
Removing Trailing spaces from Excel using asp.net Ben ASP .Net 5 01-16-2005 06:56 PM
add ability to strip off leading/trailing spaces from email regularExpressionValidator? Les Caudle ASP .Net 0 03-07-2004 12:20 PM



Advertisments