On Fri, Dec 07, 2001 at 02:09:25PM +0100, Jorge wrote: > I have this line in a file : > host clin09 { > hardware ethernet 00:80:9F:2E:3F:5E
Is this all on one line or is it two, it looks like two here. if it's two either set $/=undef; to slurp all the lines in the file into one scalar variable ($) or set a flag to say I've got host, next line should have /hardware ethernet/ in it. A regex you could use is: /hardware ethernet / && $MAC_ADR= $'; this checks to match the contents of the line to "hardware ethernet " and sets MAC_ADR to the remainder of the line after the match. This has an overhead since using $&,$` or $' in one regex means they're populated on ALL subsequent regexes, also true of $1..$9 an alternative is to use negative lookbehinds or even just plain old: $line =~s/hardware ethernet //;$MAC_ADR=$line; -- Frank Booth - Consultant Parasol Solutions Limited. (www.parasolsolutions.com) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]