Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

the try/catch example from "Programming Perl" analyzed

by pemungkah (Priest)
on Aug 18, 2004 at 16:54 UTC ( [id://384038]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub try (&$) {
       my($try, $catch) = @_;
    ...
    }
    
    sub catch (&) { $_[0] }
    
  2. or download this
      try {
         die "phooey";
    ...
      catch {
         /phooey/ and print "unphhoey\n";
      }
    
  3. or download this
      sub identity {
          return $_[0];
      }
    
  4. or download this
       sub example {
          /foo/ and print "foo detected";
    ...
       catch { 
               /foo/ and print "foo detected";
       }
    
  5. or download this
      try { 
        # some code that dies 
    ...
      catch { 
        # pattern match against $_ for die string 
      }
    
  6. or download this
      try( sub{ 
                # code that dies 
    ...
                     } 
             ) 
      );
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://384038]
Approved by Elgon
Front-paged by calin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found