use constant SUBJECT => 'Defining Constants'; # was: !0

Paul Makepeace paulm at paulm.com
Fri Feb 13 13:49:37 GMT 2009


On Fri, Feb 13, 2009 at 1:21 PM, Andy Armstrong <andy at hexten.net> wrote:
>
> On 13 Feb 2009, at 13:05, Andy Wardley wrote:
>>
>> For example:
>>
>>  use Badger::Constants 'ARRAY HASH';
>>
>>  if (ref $foo eq ARRAY) {
>>      ...
>>  }
>>  elsif (ref $foo eq HASH) {
>>      ...
>>  }
>
>
> I like this a lot.

Since you're calling a sub, and the goal is to reduce typing, why not just have,

  if (IS_ARRAY($foo)) {
     ...
  }

?

P

>
>
> --
> Andy Armstrong, Hexten
>
>
>


More information about the london.pm mailing list