KeziaKristina
Programmer
Hi,
I need help to resolve my problem.I have tried resolved it in a week but I didn't get the solution.
The problem is like this:
I have a string like this (for example, it can be more complex):
$str = '$my_var = $your_var + 2;';
I want to split the string based on a list of regexp in an array like this:
%RE = qw(
1 \$[\w]+
2 [0-9]+
3 ;
4 =
5 \+
);
The first regex of that array should match the variabel name '$my_var' or '$your_var' (variabel name) from $str.
The second regex should match '2' (any number)
The third regex should match ';' (semicolon)
the fourth regex should match '=' (assign)
the fifth regex should match '+' (addition operator)
I want to get the keys from the array that match on the each element of $str.
So, from $str i get a string like this:
$key = '1 4 1 5 2 3'
Thanks
Hope get help immediately,
Kezia Kristina
I need help to resolve my problem.I have tried resolved it in a week but I didn't get the solution.
The problem is like this:
I have a string like this (for example, it can be more complex):
$str = '$my_var = $your_var + 2;';
I want to split the string based on a list of regexp in an array like this:
%RE = qw(
1 \$[\w]+
2 [0-9]+
3 ;
4 =
5 \+
);
The first regex of that array should match the variabel name '$my_var' or '$your_var' (variabel name) from $str.
The second regex should match '2' (any number)
The third regex should match ';' (semicolon)
the fourth regex should match '=' (assign)
the fifth regex should match '+' (addition operator)
I want to get the keys from the array that match on the each element of $str.
So, from $str i get a string like this:
$key = '1 4 1 5 2 3'
Thanks
Hope get help immediately,
Kezia Kristina