in reply to Running perl and outputting to file
#!/usr/bin/perl use strict; use warnings; use GoogleSearch; @ARGV > 0 or die "usage: $0 key [query] [max results]\n"; my ($key, $query, $max) = @ARGV; # $key='000000000000000000000000'; my $google = GoogleSearch->new($key); my $result = $google->doGoogleSearch( query => $query || 'related:www.perlmonks.org', maxResults => $max || 10, )->result; open(HTML, ">related.html"); print HTML qq(<a href="$_->{URL}">$_->{title}</a><br>\n) for @{$result->{resultElements}}; close(HTML);
|
|---|