Ajit P Singh wrote:
>
> I have a eval block and some if conditions within it and I would like to
> exit the eval block.
> i.e
>
> eval{
>   my @resp = something;
>       if ((some condition)){
>               $str_output = "do something";
>         --------> I want to exit from here....to Reach After Eval
>         }
> else{
> some condition
>                  --------> I want to exit from here....to Reach After Eval
>             }
>     };
>     if($@){
> $str_output = "something";
> }
>
> Reach After Eval ...
>
> which command can i use.. something like a break in java....

'return' will get you out of an eval. From your code above it looks like you
may want something like

  $str_output = eval{

    my @resp = something;

    if (<some condition>) {
      return "do something";
    }
  }

but your pseudo code is very unclear.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to