On Tue, Jun 24, 2008 at 10:56 AM, Voytek Eymont <[EMAIL PROTECTED]> wrote:
> [..snip..]
> I have two gauges, so they output like so:
>
> ---
> a1566b0c203d1477e0f205g
> where 156.6 is the depth of tank1 in cm, 0 is the temperature sign bit,
> 20.3 is the air temperature at tank 1 in C, etc.
> ---
> I've tried
> $gotit =~ /a(\d+)b\dc(\d+)d(\d+)e\df(\d+)/;
> and
> $gotit =~ /a(\d+)b\dc(\d+)d(\d+)e\df(\d+)g/;
>
> but I'm not getting it
>
Works for me:
my $str = 'a1566b0c203d1477e0f205g';
if( $str =~ /a(\d+)b\dc(\d+)d(\d+)e\df(\d+)g/ ) {
printf( "DEPTH: %.1f\n", $1/10 );
printf( "AIR TEMP: %.1f\n", $2/10 );
}
- Gonzalo
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html