Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: matching every occurrence of a regex

by foxops (Monk)
on Jan 07, 2003 at 13:43 UTC ( [id://224967]=note: print w/replies, xml ) Need Help??


in reply to matching every occurrence of a regex

Have you tried local $/ ? The regex seems to function fine if you flatten the file. This works for me:
use strict; my($FILE,$SITE); print "Protein Sequencer\n\nInput Dataset file name: "; $FILE = <STDIN>; #chomp($FILE); local $/; #Null the $/ to search through a flat file print "\nLoading Dataset - Be patient.\n"; open DATA, $FILE or die $!;# Open File $_ = <DATA>;# Load File to Ram close DATA or die $!;# Close File print "\"N\" Sites\n---------\n"; while ($_ =~ m/\w{1,12}\s+(\d{1,5})\s+[a-zA-Z]{4}/gs) { $SITE = $1; print "$SITE\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found