Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Problem with split

by dave_the_m (Monsignor)
on Jun 01, 2018 at 09:07 UTC ( #1215607=note: print w/replies, xml ) Need Help??


in reply to Problem with split

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:

@splitted=split(/\<\/Text\>/, $text);

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1215607]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2019-05-20 09:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (126 votes). Check out past polls.

    Notices?