H
Hon Seng Phuah
When I run on the below statements, I do not understand why it zero
and here. The $a contains value zero. Why can't perl skip the print
statement?
#!/usr/intel/bin/perl
$count = "17.0";
if ($count =~ /\./)
{
($before_decimal, $a) = split(/\./, $count);
if (!$before_decimal || $before_decimal =~ /\D/)
{
exit;
}
if (!$a)
{
print "$a";
}
if (!$aft_decimal || (!$aft_decimal =~ /0$/ && $aft_decimal =~
/\D/))
{
print "Here";
exit;
}
}
and here. The $a contains value zero. Why can't perl skip the print
statement?
#!/usr/intel/bin/perl
$count = "17.0";
if ($count =~ /\./)
{
($before_decimal, $a) = split(/\./, $count);
if (!$before_decimal || $before_decimal =~ /\D/)
{
exit;
}
if (!$a)
{
print "$a";
}
if (!$aft_decimal || (!$aft_decimal =~ /0$/ && $aft_decimal =~
/\D/))
{
print "Here";
exit;
}
}