Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Split not working

by swampyankee (Parson)
on Jun 06, 2006 at 16:15 UTC ( #553852=note: print w/replies, xml ) Need Help??

in reply to Split not working

Whenever you say "X is not working," please tell us what you mean by "working." A log function is "working" if it throws an exception for log(0) but may not be "working" if it throws an exception for log(-1), which is defined in the complex domain.

Would I be correct in concluding that you want to split your string on white space? If that's the case try this:

$string="Wed 24 May 2006 09:56:12 AM EDT kdelibs3-devel"; @info = split(/\s+/, $string);

\s is the regex abbreviation for whitespace, which is the class of characters including blanks and tabs. Your surprise may be that what you expect to be the last field is separated from what you expect to be the penultimate field by a tab, vs a blank. To check this you could open the file in vi (or vim) and :set list, which will indicate tabs.

As an aside, please use code tags to surround your code and use html entities for square braces([ ]). These will make it much easier to read your posts.


e(π√−1) = −1

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://553852]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2018-07-18 15:08 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (393 votes). Check out past polls.