What is the preferred method of accessing WWW::Mechanize responses?

Posted by sid_com on Stack Overflow See other posts from Stack Overflow or by sid_com
Published on 2010-03-27T16:33:25Z Indexed on 2010/03/27 16:53 UTC
Read the original article Hit count: 232

Filed under:
|

Hello! Are both of these versions OK or is one of them to prefer?

#!/usr/bin/env perl
use strict;
use warnings;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new();
my $content;

# 1
$mech->get( 'http://www.kernel.org' );
$content = $mech->content;
say $content;

# 2
my $res = $mech->get( 'http://www.kernel.org' );
$content = $res->content;
say $content;

© Stack Overflow or respective owner

Related posts about perl

Related posts about www-mechanize