Here is part of my
Games::QuizTaker module:
package Games::QuizTaker;
use strict;
use Carp;
sub new{
my($self,%arg)=@_;
bless{
_FileName => $arg{FileName}||croak"No FileName Given",
_Delimitor => $arg{Delimitor}|| "|",
_FileLenght => "0",
}
}
sub _Print_Object{
my $self=shift;
foreach my $key(keys %$self){
print"$key = $$self{$key}\n";
}
}
Now if I create a new object with the following code:
#!/opt/perl5/bin/perl -w
use strict;
use Games::QuizTaker;
my $Q=Games::QuizTaker->new(FileName="File",Delimitor=",");
$Q->_Print_Object();
All of the variables in the object print out. However, if I remove the Delimitor from the new function, the only thing that prints out is the name of the file. Needless to say I am rather confused. I would be grateful if any one could shed some light on this.
TStanley
--------
There's an infinite number of monkeys outside who want to talk to us
about this script for Hamlet they've worked out
-- Douglas Adams/Hitchhiker's Guide to the Galaxy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.