On Jun 13, Sapna Jain said:
require two_face;
$a = 18;
if($a < 10)
{
my $n = new two_face ("vii", 7);
}
else
{
my $n = new two_face ("viii", 8);
}
print("string value = ".$n."\n");
printf "value=%d\n", 0+$n;
The problem is that $n only eixsts inside those { } blocks of code. Do
this instead:
my $n;
if ($a < 10) { $n = two_face->new("vii", 7) }
else { $n = two_face->new("viii", 8) }
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>