Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to capture all occurances from a slurped file.

by shmem (Chancellor)
on Aug 24, 2006 at 22:04 UTC ( #569465=note: print w/replies, xml ) Need Help??


in reply to How to capture all occurances from a slurped file.

You're just missing the loop:
while ($data =~ m{(\d+-)(\d+-)(\d+)(\s*/\s*)(\d+)(\s*/\s*)(\d+)}g) { print "$1, $2, $3, $4, $5, $6, $7\n"; }

After each match is found, the search continues where the last match left. So you get all occurrences.

--shmem

_($_=" "x(1<<5)."?\n".q/)Oo.  G\        /
                              /\_/(q    /
----------------------------  \__(m.====.(_("always off the crowd"))."
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: How to capture all occurances from a slurped file.
by Grey Fox (Chaplain) on Aug 24, 2006 at 23:21 UTC
    Thanks;
    I knew I was close. I just could not put my finger on what to use for the loop.
    -- Grey Fox
    Perl - Hours to learn lifetime to master.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2022-10-05 00:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (20 votes). Check out past polls.

    Notices?