Re: Perl Issues

  • From: "Jared Still" <jkstill@xxxxxxxxx>
  • To: JApplewhite@xxxxxxxxxxxxx
  • Date: Fri, 22 Feb 2008 10:02:37 -0800

On Thu, Feb 21, 2008 at 1:26 PM, <JApplewhite@xxxxxxxxxxxxx> wrote:


> My two questions:
> 1.  Can Exception Handling be easily done in Perl?  If so, any good
> examples I can point them to?


As others have already stated, Perl is very robust in the exception handling
department.


>
> 2.  They say that Perl can't handle Boolean values.  Is that true?  Any
> guidance here?
>


There's no direct boolean type, but that really should not matter.
The 'if' statement detects 0 as false and non-zero as true.

Here's a trivial example;

my $sql=q{select rownum from all_users order by rownum};
my $sth = $dbh->prepare($sql,{ora_check_sql => 0});
$sth->execute;

while( my $ary = $sth->fetchrow_arrayref ) {
   my $rownum = $ary->[0];
   my $bool = $rownum % 2;  # % is modulus operator
   if ($bool) {
      print "this is true - $rownum : $bool\n";
   }  else {
      print "this is false - $rownum : $bool\n"
   }
}



-- 
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: