To learn Perl classes I start reading perlootut Perl 5 version 22.0 documentation. In that I saw this example. As per my understanding the new works like constructor.
#!/usr/bin/perl use strict; use warnings; package File; my $hostname = File->new( path => '/etc/hostname', content => "foo\n", last_mod_time => 1304974868, ); use Scalar::Util 'blessed'; #print blessed($hash); # undef print blessed($hostname); # File
I wrote this from the example of the documentation. But its showing an error like Can't locate object method "new" via package "File" at package.pl line 9. Whats the problem in this???
In reply to Learning classes in Perl by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |