|
Posted by Petr Vileta on March 6, 2008, 7:32 pm
Please log in for more thread options Frank Seitz wrote:
> Petr Vileta wrote:
>>
>> Till now I use code bellow, but maybe can be writte as regexp.
>>
>> if($string =~ m/A:\s+([^B]+)\s+B:\s+(.+)/) { $myA = $1; $myB = $2;}
>> elsif($string =~ m/A:\s+(.+)/) { $myA = $1; $myB = '';}
>> elseif($string =~ m/B:\s+(.+)/) { $myA = ''; $myB = $1;}
>> else {$myA = $myB = '';}
>
> 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.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>
|