#!/usr/bin/perl -w -I"/home/chromatic/perl" use strict; use Sub; my $tester = Sub->new(); $tester->name; { local *OUTPUT; open(OUTPUT, ">>/home/chromatic/perl/Sub.pm") || die "Can't append: $!\n"; print OUTPUT "\nsub game {\n"; print OUTPUT " print \"Hi, this is the game subroutine.\\n\";\n"; print OUTPUT "}\n"; print OUTPUT "1;"; close OUTPUT || die "Can't close: $!\n"; } require "/home/chromatic/perl/Sub.pm"; $tester = Sub->new; $tester->game; #### #!/usr/bin/perl -w package Sub; use strict; sub new { my $class = shift; my $this = {}; $class = ref($class) || $class; bless($this, $class); return $this; } sub name { print "Hi, this is the name subroutine.\n"; } 1;