perlobj should explain this for you.
poj#!/usr/bin/perl use strict; use warnings; package MyFile; sub new { my ($class,%args) = @_; my $self = { %args }; bless $self,$class; return $self; } sub print_args { my $self = shift; for (sort keys %$self){ print "$_ = $self->{$_}\n"; } } package main; # create new object my $hostname = MyFile->new( path => '/etc/hostname', content => "foo\n", last_mod_time => 1304974868, ); # call method on object $hostname->print_args();
In reply to Re^3: Learning classes in Perl
by poj
in thread Learning classes in Perl
by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |