#!/usr/bin/perl use strict; use warnings; package String; sub new { my ($class, $text) = @_; bless \$text, $class; } sub say { my $self = shift; local($\) = "\n"; print ${$self}; } package main; my $foo = new String ('Hello World!'); $foo->say(); say $foo;