|Pathologically Eclectic Rubbish Lister|
Re^5: If conditional checksby Kenosis (Priest)
|on Dec 12, 2012 at 21:46 UTC||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.