Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: regex match multiple line

by james28909 (Deacon)
on Nov 27, 2014 at 01:48 UTC ( [id://1108519]=note: print w/replies, xml ) Need Help??


in reply to Re^2: regex match multiple line
in thread regex match multiple line (updated question)

while ( my ( $key, $value ) = each %pwd_reset_errors ) { if ( $key =~ m/^$error.*/ ) { ... }
This iterates thru the hash list %pwd_reset_errors right? So whats wrong with doing it like this above IF the key matches the error code? Why would you want to match it the other way around? I am just asking for better understanding :)

To me its like you wanting to do soemthing of this nature:
my $one = 1; if ($one =~ 1){ ... }elsif(1 =~ $one){ ... }
Why would it matter if $one eq 1 or 1 eq $one, they were both the same thing. But like i said i am just asking for better understanding.


EDIT: I just realized that Net::LDAP error is quite different than your keys in the hash. You could split the error code from Net::LDAP so it just contains everything before ':' and then match either way.

EDIT 2: I had to much coffee. ;l

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-26 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found