That's for the main script. Here are the two packages.#!/usr/bin/perl -w use Ring; use GirlFriend; use strict; my $gf = GirlFriend->new(); my $ring = Ring->new(); print "I love my ", ref( $gf ), " ", $gf->{name}, "...\n"; print "So I gave her this ", $ring->{ring}, " ", ref( $ring ), "\n"; print "She's the best...\n"; print " She said yes...\n"; print " She makes me want to sing\n\n"; print "\t\t\t-Kel :)\n";
One.
Two#!/usr/bin/perl -w package Ring; use strict; sub new { my $class = shift; my $self = { }; if ( !( $class ) ) { die "Usage: 'Ring->new()'\n"; } bless $self, $class; $self->{ring} = "Pretty"; return $self; } 1;
Nothing too complex. Just something I couldn't hold in any longer. :)#!/usr/bin/perl -w package GirlFriend; use strict; sub new { my $class = shift; my $self = { }; if ( !( $class ) ) { die "Usage: 'GirlFriend->new()'\n"; } bless $self, $class; $self->{name} = "Beth"; return $self; } 1;
- kel -
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A Little Good News
by danger (Priest) on Feb 21, 2001 at 21:55 UTC | |
|
Re: A Little Good News
by marius (Hermit) on Feb 21, 2001 at 21:47 UTC | |
|
Re: A Little Good News
by TStanley (Canon) on Feb 21, 2001 at 23:10 UTC | |
|
Re: A Little Good News
by arhuman (Vicar) on Feb 21, 2001 at 21:50 UTC | |
by dsb (Chaplain) on Feb 21, 2001 at 21:51 UTC |