I think you need to start reading on a few books my friend.

here are a few places to start:

read the regexp tutorial i wrote at http://japh.nu
read "perldoc perlre" for more details
look into getting "learning perl" by randal schwartz, it will teach you many
of the basics you'll need for Perl

now the answer to your question is actually given by yourself:
the code is almost the same, except for the regexp
obvious conclusion, regexp is failing.

why is it failing? welcome to programming 101: learn to debug your code

add print statements, read man pages, perldocs, figure it out

let me give you a fast clue: the regexp is failing because simply what
you're asking it to match isnt in the file you're supplying.

regards,

Jos

> Why does this work:
>         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) {
>         print $h;
>     #blah blah blah
>
> But this doesn't:
>
> open(FP, "$tempfile"); # Open $tempfile for reading
>                 my $i=0;
>                 while(<FP>) {
>                         push (@list, $1)
>                         if /(.com\S)/;
>                 }
>                 foreach my $h(@list) {
>                         print "$h";
>                 }
>
> They're more or less the same thing except the regexps are different....
>
> Tyler


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to