in reply to why this couldn't work?

I really doubt that CURLOPT_HEADER has the value you want, in your second example. If you had used strict and/or warnings, Perl would have told you so:

use strict; require WWW::Curl::Easy; import WWW::Curl::Easy; my $curl = WWW::Curl::Easy->new; $curl->setopt(CURLOPT_HEADER,0); # boom

You will either need to fully qualify the names of the constants, or import them before your code gets compiled:

use strict; require WWW::Curl::Easy; import WWW::Curl::Easy; my $curl = WWW::Curl::Easy->new; $curl->setopt(WWW::Curl::Easy::CURLOPT_HEADER,0); # or wherever CURLOP +T_HEADER gets declared