in reply to Extract value between quotes
If you look up split, you will see that it expexts a string as its second argument. @FiTime will be evaluated in scalar context, which is the number of fields in the array, e.g. 1. The regex provided to split will not match, so ActTime will only contain one element, i.e. 1.
Secondly, your regex /(^".*")/ does not match your string, as the caret matches only from the beginning of your string. Try something like /"(.*?)"/ which will return the string between the first two quotes encountered.
In total, you probably want to apply the regex to each element of your array like this:
my @ActTime = map { /"(.*?)"/ } @FiTime;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extract value between quotes
by kaka_2 (Sexton) on Oct 21, 2013 at 16:27 UTC | |
by Athanasius (Archbishop) on Oct 22, 2013 at 06:51 UTC |