Google returned the page from a search result, where it gets the pages from is not my fault.
Besides I am not sure where you are going with this ? Are you saying that the content on the web page if pirated so I should not view it ? Information should be free, I believe all books and information resources should be free. As in free beer :) How do we expect people to grow and learn by restricting the resources that we have. Libraries should be moved online, with free or next to free access for all. Save some trees :) Michael. On Thu, 2005-03-31 at 10:28 +1000, Alfred Vahau wrote: > Michael, > I noted from your original posting that you quoted from a URL which is > controversial > in that the Perl-related books from O'Reilly are actually pirated > copies. This was pointed out by one of the > subscribers to this list in a recent thread. > > Alfred, > > > Michael Gale wrote: > > Hello, > > > > I fixed it, the string would initially contain special characters such > > as % signs. I strip out all the characters before the check, instead of > > after. > > > > Michael. > > > > > > > > On Wed, 2005-03-30 at 16:19 -0700, Michael Gale wrote: > > > > > Hello, > > > > > > I tried your example, it worked as expected, here is the entire code: > > > > > > --snip-- > > > > > > my @servers; > > > my $each_server; > > > my $each_host; > > > my %seen = ( ); > > > > > > print "<h2>List of systems being performance monitored</h2>\n"; > > > print "Please select a host\n"; > > > > > > opendir(RRDDIR,"/home/nagios/network-monitor/nagiosgraph/rrd") > > > || die "Can't find servers"; > > > @servers = readdir(RRDDIR); > > > closedir RRDDIR; > > > > > > sub show_host{ > > > my($each_host) = @_; > > > my $thost; > > > $each_host =~ /(.*)_(.*)_/; > > > $thost = $1; > > > $thost =~ s/\%2D/ /g; > > > #print "$thost<BR>\n"; > > > print "<option value=\"$thost\">$thost\n"; > > > } > > > > > > print "<form name=serverlist action=layout.cgi > > > method=GET>\n"; > > > print "<select name=server size=10>\n"; > > > > > > foreach my $each_server(@servers) > > > { > > > unless ($seen{$each_server}) { > > > $seen{$each_server} = 1; > > > show_host($each_server); > > > } > > > } > > > > > > print "</select>\n"; > > > print "</form>\n"; > > > > > > --snip-- > > > > > > On Wed, 2005-03-30 at 18:12 -0500, Offer Kaye wrote: > > > > > > > On Wed, 30 Mar 2005 15:53:25 -0700, Michael Gale wrote: > > > > > > > > > But it is not working as expected, even if the array has the first > > > > > three > > > > > entries the same, the function "show_host" gets called three time ? > > > > > > > > > > foreach $each_server(@servers) > > > > > { > > > > > unless ($seen{$each_server}) { > > > > > $seen{$each_server} = 1; > > > > > show_host($each_server); > > > > > } > > > > > } > > > > > > > > > > > > > > The code is okay. Try just the following in a standalone file: > > > > ########## begin code > > > > use strict; > > > > use warnings; > > > > my @servers = qw/a a a b c d/; > > > > my %seen; > > > > foreach my $each_server(@servers) { > > > > unless ($seen{$each_server}) { > > > > $seen{$each_server} = 1; > > > > show_host($each_server); > > > > } > > > > } > > > > sub show_host { > > > > print "$_[0]\n"; > > > > } > > > > ########## end code > > > > If you run it, you will see it just prints "a" once, not 3 times. > > > > So the problem is in some other code you are not showing us. > > > > -- > > > > Offer Kaye > > > > > > > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>