Jorge Goncalvez wrote:
>
> How in Perl you specify a line in a file that don't begin with something for
> exemple I wanted to specify the last line of my file don't begin with
> LOG_INFO,dhcpd or ftpd ?
Use regular expressions with negative lookahead.
E.g, to check a line doesn't start with LOG_INFO, ... just use:
unless ($line =~ /^(?!LOG_INFO|dhcp|ftpd)/) {
# line doesn't start with them
}
or if you want to be the quickest in the world, try:
unless ($line =~ /^ (?! [Ldf] )
(?! LOG_INFO | dhcp | ftpd )
/x) {
# line doesn't start with them
}
Best Wishes,
Andrea
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]