Hello,

when I run this script I get the results:

#!/usr/bin/perl
#obj1.pl
# package Useless;

use warnings;
sub method { return "sometimes I don't understand Perl and often I am wrong" }

my $obj = bless [];

print main::method, "\n";
print main::, "\n";
print $obj, "\n";
print $obj->method, "\n";

Output:

sometimes I don't understand Perl and often I am wrong
main
main=ARRAY(0x814dc28)
sometimes I don't understand Perl and often I am wrong

Why "print main::" gives main ?

If I uncomment "package Useless" I get:

main::method
main
Useless=ARRAY(0x814dc28)
sometimes I don't understand Perl and often I am wrong

why perl doesn't complain instead to display main::method and main ?

tia

-- 
Gérard 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to