In my perl program, I am having a string in $new which is of variable length. Following are some of the instances:
$new = "sdf / wer / wewe / dfg";
$new = "lkjz / dfgr / wdvf";
$new = "asdfe";
How do I extract the elements seperated by / into an array using Regex?
You can use the
splitfunction, which takes as arguments a pattern to split on, the string to split, and optionally the number of times to split.