Tyler Longren wrote: > > ... > I need to get whatever the ServerName is. Here's what I have: > open(APACHE_CONF, "/usr/local/apache/conf/httpd.conf") or die "Could not > open Apache config file:\n$!\n"; > my @servernames; > while(<APACHE_CONF>) { > push (@servernames, $1) > if/ServerName\swww..(.*)/; > } > close(APACHE_CONF); > my $h; > foreach $h(@servernames) { > # blah blah blah > } > > That only gets the ServerName if it starts with a "www". How could I get it > no matter what ServerName starts with?
Leave it out in the regexp: if/ServerName\swww..(.*)/; ^^^ change to: if /ServerName\s(.*)/; That will include www into your servernames. If you want the servernames without leading www, but recognice all other servernames, too, you would need: if /ServerName\s(?:www\.)?(.*)/; Another question: Your regexp contains two dots after the www: if/ServerName\swww..(.*)/; if the ServerName is www.blahblah.de, in $1 will only lahbla.de captuered. The leading b is cut away. Best Wishes, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]