Harry Putnam wrote:

> david <[EMAIL PROTECTED]> writes:
> 
>> Harry Putnam wrote:
>>
>>> david <[EMAIL PROTECTED]> writes:
>>> 
>>> Won't is still quite even with the eval, in the above case?
>>>> passing it to Perl
>>> 
>>> Can you give an example of this?
>>
>> no it doesn't. if you put it inside an eval{}, it won't quit. consider:
>>
>> #!/usr/bin/perl -w
>> use strict;
>>
>> my $reg = shift;
>>
>> while(<STDIN>){
>>         chomp;
>>         eval{
>>                 print "$_\n" if(/$reg/o);
>>         }
>>         print "ERROR: $@\n" if($@);
>> }
>>
>> __END__
> 
> I must be a real dunce, but I still don't get the point.
> If a bad regex is given, I want the program to stop.
> 

ok then, how about changing:

print "ERROR: $@\n" if($@);

to:

die("You probably supply a bad reg. in $reg. Aborted!\n") if($@);

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to