go ahead... be a heretic | |
PerlMonks |
Re: Problem with splitby dave_the_m (Monsignor) |
on Jun 01, 2018 at 09:07 UTC ( [id://1215607]=note: print w/replies, xml ) | Need Help?? |
You have a dot (concatenation operator) after the pattern, rather than a comma.
PS: note that split takes a pattern rather than a string as the regex; if you supply it with a string, that string undergoes normal double-quoted string processing, before belated being passed to the regex engine, which can cause things like \b to be misinterpreted. So get into the habit of using pattern delimiters:
PPS: my @splitted=[]; doesn't do what you think it does. It is setting @splitted to contain one element, which is a reference to an array. You probably meant my @splitted= (). But that is doubly redundant; firstly the my declaration already creates an empty array, and secondly you immediately assign a new value to the array anyway - the returned list from split - so it doesn't matter if the array wasn't empty before. Dave.
In Section
Seekers of Perl Wisdom
|
|