[pm-h] July Meeting

Robert Boone robo4288 at gmail.com
Tue Jul 22 07:36:47 PDT 2008


The short cut for if(!defined $value); is a perl 5.10/6 feature:
      $value //= "some sorta default";

The other is good in all perl 5 version and lower, I think:
     $value = "some sorta default" if(!$value);
     becomes
     $value ||= "some sorta default";


On Jul 22, 2008, at 9:31 AM, Todd Rinaldo wrote:

> ok so someone explain these operators, cause obviously I shoulda read
> the whole camel book!
>
> Here is what I've always had to do the hard way. what's the simpler?
>
> I often do this
> sub foo {
>  my $value = shift;
>  $value = "some sorta default" if(!defined $value);
>
> }
>
> Of course sometimes I want to do the permutation:
>
> sub bar {
>  my $value = shift;
>  $value = "some sorta default" if(!$value);
>
> }
>
> is there a simpler way?
> _______________________________________________
> Houston mailing list
> Houston at pm.org
> http://mail.pm.org/mailman/listinfo/houston
> Website: http://houston.pm.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2419 bytes
Desc: not available
URL: <http://mail.pm.org/mailman/private/houston/attachments/20080722/a3dd9c45/attachment-0001.bin>


More information about the Houston mailing list