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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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



Aug 5, 2002, 6:19 AM

Post #1 of 2 (550 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 ?

Enthusiast / Moderator

Aug 5, 2002, 7:42 AM

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

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