One more quick question.  How can I count the values in an array
(@servernames)?
I want to print my servernames seperately:

$i=0;
while ($i <= $num_servers) {
print "$servernames[$i]\n";
}
Something like that (I don't know if that will even work in perl...but it
does in PHP).

Thanks!
Tyler


----- Original Message -----
From: "Brett W. McCoy" <[EMAIL PROTECTED]>
To: "Tyler Longren" <[EMAIL PROTECTED]>
Cc: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 9:18 AM
Subject: Re: arrays


> On Thu, 28 Jun 2001, Tyler Longren wrote:
>
> > I'm just starting perl.  I want to search through httpd.conf and get the
> > ServerName from each virtual host.
>
> Sure:
>
> open(APACHE_CONF, "httpd.conf") or die "Could not open Apache config file:
> $!\n";
>
> my @servernames;
>
> while(<APACHE_CONF>) {
>
> if(/^ServerName\s(.*)$/i) {
> push @servernames, $1;
> }
> }
>
> close(APACHE_CONF);
>
> -- Brett
>
>    http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> Tuesday After Lunch is the cosmic time of the week.

Reply via email to