CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Adding white spaces to a string

 



mauto
User

Aug 5, 2002, 6:19 AM

Post #1 of 2 (359 views)
Adding white spaces to a string Can't Post

my $str = "ABC";

I want to add a variable no. of white spaces ($spaces) to the end of my string $str. How can I do this ?


mhx
Enthusiast / Moderator

Aug 5, 2002, 7:42 AM

Post #2 of 2 (358 views)
Re: [mauto] Adding white spaces to a string [In reply to] Can't Post


Code
my $str = "ABC"; 
my $num = 5;

$str .= ' ' x $num; # adds 5 blanks to $str


-- mhx

At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

-- Frodo


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives