Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Problem with split

by dave_the_m (Monsignor)
on Jun 01, 2018 at 09:07 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1215607]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-19 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found