Skip to content

Instantly share code, notes, and snippets.

@IzumiSy
Created April 4, 2014 02:01
Show Gist options
  • Save IzumiSy/9966679 to your computer and use it in GitHub Desktop.
Save IzumiSy/9966679 to your computer and use it in GitHub Desktop.
Google search from terminal
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Encode;
our $args = decode_utf8($ARGV[0]);
foreach my $i (1 .. $#ARGV) {
$args = $args . "+" . decode_utf8($ARGV[$i]);
}
our $num = 10;
our $url = "http://www.google.com/search?hl=ja&ie=UTF-8&num=$num&q=$args";
our $cmd = "x-www-browser \"$url\"";
print "Query: \"$args\"\n";
print "Launching a web browser...\n";
system($cmd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment