Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.43 KB | None | 0 0
  1. use strict;
  2. use WWW::Google::Calculator;
  3. use Data::Dumper;
  4.  
  5. &calculate('100 cm in inches');
  6.  
  7. sub calculate {
  8.         my $what = $_;
  9.         my $calc = WWW::Google::Calculator->new;
  10.         my $result = $calc->calc($what);
  11.         print Dumper($result);
  12.         if(!$result) {
  13.                 print "No result\n";
  14.         } else {
  15.                 print "Result\n";
  16.         }
  17. }
  18.  
  19. # Produces
  20. # $VAR1 = undef;
  21. # No result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement