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

It's Not Clear What You're Doing - Re: pattern matching

by metadoktor (Hermit)
on Mar 29, 2002 at 02:43 UTC ( #155185=note: print w/replies, xml ) Need Help??

in reply to unitialized value error in pattern matching script

I think that your code has some really serious problems if you posted it without errors. I'm not sure what you're attempting with $_myfile[$i]? Perhaps you meant $_[$i] or $myfile[$i]? Also the regex you attempted does not have a trailing / (forward slash). Also the 'filename' variable you posted should be '$filename'.

Something like the following should work assuming that @myfile has been defined to be an array and contains the required filenames.

for (@myfile) { if (/$filename/) { print "Found pattern.\n"; } }
Now another problem is that you seem to want to extract some substrings from the matched string by your use of parens in the regex yet it is unclear what you're trying to do here since you already know that the pattern is '' or is it?


"The doktor is in."

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2019-07-19 12:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found