develooper Front page | perl.beginners | Postings from January 2002

Re:Regex improvment needed

Thread Next
From:
Jorge Goncalvez
Date:
January 15, 2002 01:36
Subject:
Re:Regex improvment needed
Message ID:
200201150936.KAA16124@cabs40.col.bsf.alcatel.fr
Hi, I have this code to parse a file and get the hardware address:
sub ParseInitDhcpdconf() {
open VIEUX,"$_Globals{DHCPDCONF}" or die "je ne peux ouvrir
$_Globals{DHCPDCONF} :$!";
	while (<VIEUX>) {

		if (/hardware ethernet /) {
			$_=(split/\{/)[1];
			s/[^\d:A-F]//g;		# remove anything not 0..9,A..F 
or :
			print "$_\n";
			$_Globals{MAC_ADDRESS}="$_";

		}
	}
	close VIEUX;
	
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.
my file looks like this:
.........
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;
..........	 
	
Thanks	
	


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About