#!/usr/bin/perl #use Filter::Self; use Filter::Self qw(echo); my $hello = Hello->new("World"); $hello.hello(); $hello.hello('casual', 1); package Hello; sub new($class, $who) { my $self = bless {}, $class; .who = $who; .greeting.casual = 'Hi'; .greeting.normal = 'Hello'; .greeting.polite = 'Good-day'; .greeting.grumpy = 'Ugh'; return $self; } sub .hello($type, $caps) { my $greeting = .greeting{$type||'normal'}; my $msg = "$greeting, " . .who; $msg = uc($msg) if $caps; print "$msg\n"; # test quote-like ops: print "who: $.who\n"; print 'who: $.who\n'; print qq{who: $.who\n}; print q{who: $.who\n}; print <