Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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.

emc

e(π√−1) = −1

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2018-01-17 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (200 votes). Check out past polls.

    Notices?