Jorge Goncalvez wrote:
> Hi, I have this code to parse a file and get the hardware address:
<snip>
> It works fine but if that comes after hardware ethernet contains a..f in 
> lowercase the letter are ommitted.
> How can i get rid of this behaviour.

#!/usr/bin/perl -w
use strict;

use vars qw(%_Globals);

ParseInitDhcpdconf();

print "$_ => $_Globals{$_}\n" for keys %_Globals;

sub ParseInitDhcpdconf {
    while (<DATA>) {
        if (/{hardware ethernet\s+([:0-9a-z]+);/i) {
            print "found $1\n";
            $_Globals{MAC_ADDRESS} = uc($1);
        }
    }
}

__DATA__        
........
host clin09 {hardware ethernet 00:56:9C:6B:8A:15;
...........
but it can be for exemple
.......
host clin09 {hardware ethernet 00:56:9c:6b:8a:15;
.........        

-- 
briac
        Seven trout out of 
        the pool. A flying thrush. A 
        fox walks. A songbird.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to