and here is the code I was using to test with which is pretty much as shown in the previous message with a little formatting of the output.


#!/usr/bin/perl

use strict;
use warnings;

use constant HR => "\n\n" . '-'x60 . "\n\n";

print HR;

my %ahash;
my $href = \%ahash;

$href->{key} = 'value';
print $href->{key};

print HR;

my $blessed_ref = bless $href;

print $blessed_ref->{key};

print HR;

sub say_hello { print "Hello, World!\n"; }
$blessed_ref->say_hello();

print HR;

use Data::Dumper;
print Dumper($blessed_ref);
sub show_args { print Dumper([EMAIL PROTECTED]); }
$blessed_ref->show_args();

print HR;

show_args();

print HR;

sub inc {
  my $self = shift;
  return ++$self->{counter};
}

print $blessed_ref->inc()."\n" for (1..5);

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to