Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

splitting up a variable.

I've got a variable that looks like this:
$variable="this file can,be deleted,is this ok";
Now I want this variable to be splitted up , in three other variables namely $var1 and $var2 and $var3, at the point where the , resides. The outcome must look like this:
$var1="this file can";
$var2="be deleted";
$var3="is this ok";
(note: I don't want the , to be either in $var1 or $var2 or $var3)

Can someone help me out ?
0
oostwijk
Asked:
oostwijk
  • 2
1 Solution
 
akfCommented:
If this is in Perl (which it looks like), it's easy:

($var1, $var2, $var3) = split(',' , $variable);

0
 
akfCommented:
If this is in Perl (which it looks like), it's easy:

($var1, $var2, $var3) = split(',' , $variable);

0
 
oostwijkAuthor Commented:
Ok, that does the job :))
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now