Perl Tutorial : Perl data types
Perl Tutorial : Perl Operators
Perl Tutorial : Perl loops
Perl Tutorial : Perl Conditionals
Perl Tutorial : Perl Subroutines
Perl Tutorial : Perl regex
Perl Tutorial : Perl Files
Perl Tutorial : Perl & Databases
Perl Tutorial : Perl OOPs
Perl Tutorial : Perl signals
Perl Tutorial : Perl threads
Perl Tutorial : Perl Debugging

Introcution to Perl CGI

Introduction to modperl
Home >> perlfunctions >>

eval

eval() has two forms. The first takes a string, and treats it as Perl code. It compiles and executes it, returning whatever value is appropriate. If there is a fatal error, it sets the $@ variable. The other form is eval { CODE }. This executes a block of code in a fail-safe environment. If there are any fatal errors, the $@ is set, and the block is exited. A common use for this is:
print "Give me a number: ";
chomp(my $n = );
my $result = eval { 100 / $n };
if ($@) {
    errorHandler($@);
}

Perl functions

scalars and strings

lc
ord

regex (regular expressions)

arrays

shift
split

More..

eval
Share |

List of all perl functions
ord
perl function : split
Perl function: lc
shift

Perl examples

  • How to use Data::Dumper?
  • How to parse config file?
  • Include external module in perl..
  • Download perl

    download stable version of perl
    Perl 5.10.1
    Perl interview Questions
    sed tutorial
    awk tutorial

    Join us on Google Groups

    Subscribe to perl
    Email:
    Visit this group
    Perl Jobs


    privacy | sitemap | disclaim | contact us
    © 2009 perlhome.com