http://www.perlmonks.org?node_id=251632


in reply to Re: Re: Location of 'use' statements
in thread Location of 'use' statements

Yep, Data::Dumper for example will complain (under -w) about printing to an unopened file handle if you say

Actually its perl that complains here. The warning is provided because perl reads

print Dumper $quux;

as

use IO::File; Dumper->print($quux);

when 'Dumper' is an unknown bareword. Personally I always disambiguate print statements in some way just because ive been bitten a few times.

Incidentally in this case its not much harder (and often desirable) to replace that with

print Data::Dumper->new([$quux],['quux'])->Dump(),"\n";

I say desirable, and use the long winded ->new() form because now we can easily add stuff in the middle:

# we have large cyclic structures: disable pretty indent, enable purit +y mode. print Data::Dumper->new([$quux],['quux'])->Purity(1)->Indent(1)->Dump( +),"\n";

---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...