|
Posted by Gunnar Hjalmarsson on March 7, 2008, 4:25 am
Please log in for more thread options
Frank Seitz wrote:
> Petr Vileta wrote:
>> Frank Seitz wrote:
>>>
>>> my ($myA) = $string =~ /A:\s+(\S+)/;
>>> $myA //= '';
>>> my ($myB) = $string =~ /B:\s+(\S+)/;
>>> $myB //= '';
>>>
>>> (//= Perl 5.10)
>>
>> Thank you Frank for response, but your solution is unusable for now. On many
>> servers Perl 5.8 is installed and on some 5.6.1 too.
>
> $myA //= ''
>
> is equivalent to
>
> $myA = '' if !defined $myA;
$myA ||= '';
works just as well, doesn't it?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
|