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: Intermediate:
string to array?

 



mike_robb
Novice

Jun 25, 2001, 1:37 PM

Post #1 of 3 (529 views)
string to array? Can't Post

I have a string variable that contains | as a deliminator

how do i get the string split into an array?

$s = "abc|def|ghi|jkl";
@a = $s.split("|");

This does not seem to work , is there a better method?

TIA!



mhx
Enthusiast / Moderator

Jun 25, 2001, 1:46 PM

Post #2 of 3 (528 views)
Re: string to array? [In reply to] Can't Post

Hi,

you were on the right way. Try this:

Code
$s = "abc|def|ghi|jkl"; 
@a = split /\|/, $s;

-- Marcus



mike_robb
Novice

Jun 25, 2001, 1:53 PM

Post #3 of 3 (527 views)
Re: string to array? [In reply to] Can't Post

Thanks!


 
 


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

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