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

Re: There has to be an easier way...

by BlaisePascal (Monk)
on Aug 16, 2000 at 01:14 UTC ( [id://28039]=note: print w/replies, xml ) Need Help??


in reply to There has to be an easier way...

Your data is delineated by "|"? How about:
($clliA,$clliB) = (split "|",$source,16)[14,15];
This splits $source into fields that were separated by |, but only the first 16 of them, and puts them into a list, of which you the 15th and 16th elemensts thereof.

Update I guess everyone thought of split...and are faster typers!

Your use of .* is particularly inefficient. Going with a simpler 3-field case: /^.*A.*A.*$/, it would match "shAzAm" by:

match "shAzAm" with .*, can't find A, backtrack. match "shAzA" with .*, can't find A, backtrack. match "shAz" with .* match "shAzA" with .*A match "shAzAm" with .*A.*, can't find A, backtrack match "shAzA" with .*A.*, can't find A, backtrack match "shA" with .*, can't find A, backtrack match "sh" with .* match "shA" with .*A match "shAzAm" with .*A.*, can't find A, backtrack,
and so forth. Imagine that with 16 .*A combinations, like you had.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found