in reply to (Ovid) Re: Unable to put default value in object hash
in thread Unable to put default value in object hash
And my testing program is as follows:package Games::QuizTaker; use strict; use Data::Dumper; use Carp; sub new{ my($class,%args)=@_; bless{ _FileName => $args{FileName}||croak"No FileName given", _Delimiter => $args{Delimiter}|| "|", _FileLength => "0", },$class; } sub Print_Object{ my $self=shift; print Dumper($self); } 1;
However, when I do run the above script, the Print_Object shows only the _FileName parameter within the object. I am trying to get the _Delimiter parameter to be set to a pipe character if the Delimiter isn't passed in.#!/opt/perl5/bin/perl -w use strict; use Games::QuizTaker; my $Q=Quiz->new("FileName"=>"File"); $Q->Print_Object();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re(3): Unable to put default value in object hash
by Ovid (Cardinal) on Nov 15, 2001 at 04:33 UTC |