On Feb 15, 2008 11:56 PM, howa <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Currently I have seen two way to create objects in Perl:
>
> 1. my $a = new Apple...
> 2. my $a = Apple->new();
>
> What are the differences, and which one is recommended?
>

Both are fine:

$ perl -le 'package A;sub new{print shift} package main;new A'
A
$ perl -le 'package A;sub new{print shift} package main;A->new'
A

but the second one is recommended, it looks more like the OO way.

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


Reply via email to