0
use strict;    # safety net
use warnings;  # safety net
use feature 'say'; # a better "print"

use Mojo;
my $dom = Mojo::DOM->new;
my $ua = Mojo::UserAgent->new;
$dom= $ua->get('http://search.cpan.org/faq.html')->res->dom;
my $desc=$dom->at('#u')->text;

when I run this code the above error has occur . This is my input data form following web page pls refer this

I want output like this only answers.

   CPAN Search is a search engine for the distributions, modules, docs, and ID's on CPAN. It was conceived and built by Graham Barr as a way to make things easier to navigate. Originally named TUCS [ The Ultimate CPAN Search ] it was later named CPAN Search or Search DOT CPAN.

   If you are having technical difficulties with the site itself, send mail to cpansearch@perl.org and try to be as detailed as possible in your note describing the problem.

pls anyone can help me

Chella
  • 43
  • 6
  • 1
    #u is looking for an html element with the id=u. There isn't on that page. Read up on css selectors: http://www.w3schools.com/cssref/css_selectors.asp – Miller Jan 11 '16 at 07:23

1 Answers1

1

Something like this:

perl -Mojo -le 'print r g("http://search.cpan.org/faq.html")->dom("#cpansearch > div.pod > p")->map("text")->to_array;'
Logioniz
  • 891
  • 6
  • 15