|
|
| Do you know where your variables are? | |
| PerlMonks |
Re^5: If conditional checksby Kenosis (Deacon) |
| on Dec 12, 2012 at 21:46 UTC ( #1008595=note: print w/ replies, xml ) | Need Help?? |
|
You're most welcome! Here's the regex in the grep (with two added features that should be there):
If you remove the trailing $, it'll match a host name beginning with "db". Try the following with and without the trailing $ in the regex:
Output with $:
This is because if forces an exact match, like $host eq 'db'. Output without $:
This is becuase it's only matching the first two characters of $_ (the default scalar) against the value of $host. Note that there's the i modifier at the end of the regex. This makes the match case-insensitive, in case you have a host like DB4323.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||