Hi there,
I have a variable of the following format
$test="value1|value2|value3|value4.....";
and what I want to do is to have value1 and value3 assigned to new variables;
If using split, I have something like
@temps = split (/\|/, $test);
$var1 = temps[0];
$var2 = temps[2];
My question is, is it possible for me to do this split in a one liner? Also, if we consider speed (resource used), will it be better if I used a regular expression statement to perform this task? or is the split function more efficient?
Thanks!
I have a variable of the following format
$test="value1|value2|value3|value4.....";
and what I want to do is to have value1 and value3 assigned to new variables;
If using split, I have something like
@temps = split (/\|/, $test);
$var1 = temps[0];
$var2 = temps[2];
My question is, is it possible for me to do this split in a one liner? Also, if we consider speed (resource used), will it be better if I used a regular expression statement to perform this task? or is the split function more efficient?
Thanks!