Hi
Mark Mielke wrote:
> Hakim Cassimally wrote:
>> I wanted to be able to write:
>>
>> my $x = given ($blah) {
>> ....
>> default { 'foo' }
>> }
>>
>> ...
>> Is there a way to work around this limitation?
>> And would it be worthwhile me submitting a docpatch to perlsyn?
>>
>
> Seems like along that path would lie:
>
> my $x = if ($blah) { ... } else { 'foo' };
>
For the if construct you can always wrap it into an eval:
my $x = eval { if ($blah) { ... } else { 'foo' }; }
Not sure if it works for switch (didn't try).
ambs
--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal
Thread Previous
|
Thread Next