Cool/useful short examples of Perl?

David Matthewman david at matthewman.org
Wed Jun 8 18:43:13 BST 2011


On 8 Jun 2011, at 13:17, Tom Hukins wrote:

> On Wed, Jun 08, 2011 at 02:00:41PM +0200, Abigail wrote:
>> I'd rather go for sacking people that don't know the difference 
>> between 
>> 
>>    if (something) { ... }
>> 
>> and
>> 
>>    unless (!something) { ... }
> 
> It's sunny outside and pubs are open:  I can think of worse times to
> lose my job.
> 
>> Or does everyone think they are always equivalent?
> 
> I'm not everyone, and with a language as flexible as Perl I hesitate
> to make strong statements involving words like "always", but I don't
> recall encountering a situation where they differ.

If 'something' is 'something && something_else' then you *really* want to put brackets around it before adding a '!' at the start.

But that's so trivial it barely needs saying, yes?

-- 
David Matthewman




More information about the london.pm mailing list