Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: how to split a string at [ ?by Athanasius (Archbishop) |
on Jul 05, 2018 at 07:04 UTC ( [id://1217927]=note: print w/replies, xml ) | Need Help?? |
Hello blaui, You can just use a regex:
Output:
The regex says: match an equals sign, followed by zero or more whitespace characters, followed by one or more digit-or-decimal-point characters, followed by a left square bracket; and capture the string of digit-or-decimal-point characters in $1. The /x modifier on the regex means to not match whitespace inside the regex: this just makes the regex easier to read. Update: Note that it is necessary to escape the square bracket to tell the regex engine that this is a character to be matched literally, and not the beginning of a character class. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|