Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: accumulating rex-exp matches in an array

by japhy (Canon)
on Jun 25, 2002 at 18:27 UTC ( [id://177167]=note: print w/replies, xml ) Need Help??


in reply to accumulating rex-exp matches in an array

You should never use a regex variable without making sure the regex matched. If a line DIDN'T contain "AAA.n", $1 would retain its value!

Anyway, you want to use the /g modifier:

while (<INFILE>) { push @list, /AAA.\d/g; # parens not needed in regex here }

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-03-19 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found