Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Split of text

by hdb (Prior)
on Apr 09, 2014 at 06:21 UTC ( #1081609=note: print w/ replies, xml ) Need Help??


in reply to Split of text

Here is a little code segment to get you started:

while(<DATA>){ my $date; $date = $1 if s/(\d+\.\d+\.\d+)\s*//; my $ccy; $ccy = $1 if s/([a-z]+)\s*//i; print "Date=$date, Currency=$ccy, Rest=$_\n" if $date && $ccy; }

assuming you have your data in the DATA segment. Dealing with processing the remaing fields is left as an exercise. You might want to consider splitting on semicola...


Comment on Re: Split of text
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-09-21 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (172 votes), past polls