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:
Strings question

 



abuschr
Novice

Aug 20, 2002, 4:25 AM

Post #1 of 2 (501 views)
Strings question Can't Post

Is there a way to think about a string as an array?

I mean that if I have a string like this:

my $string = "bla bla bla";

and I want to change the third letter from a to o, how can I do it?

Can I do something like $string[2] = "o" ?


davorg
Thaumaturge / Moderator

Aug 20, 2002, 4:39 AM

Post #2 of 2 (500 views)
Re: [abuschr] Strings question [In reply to] Can't Post


Code
substr($string, 2, 1) = 'o';


--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


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

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