Sebastian Stumpf wrote:
>
On Sat, 11 Nov 2006 17:11:45 +0000
Nigel Peck <[EMAIL PROTECTED]> wrote:
>>
my ( $val1, $val2 ) = $data =~ /^([^:]+):([^:]+)$/
        || die 'Failed to parse data';

Just use brackets around the regexp:
my ($val1, $val2) = ($data =~ //);

That's the same as the OP wrote: =~ hash a higher priority than =

die unless $val1 && $val2;

Will die if the original string was something like 'COUNT:0'

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to