[EMAIL PROTECTED] wrote:
> 
> i did that with this line
> 
> my ($killer, $did, $whom, $by, $what) = /^(\S+) (\S+) (\S+) (\S+) (\S+)/;
> 
> $1 = $killer and so on, thought that it might be easier for ppl to
> understand if i put it out as $1 , $2 ..
> 
> in the worst case i had a user with 2 spaces in his name
> like "Elephant Master Killer" ..
> 
> here is an true line from the log:
> 
> ^7Kore^7Adam killed BEST I TEST by MOD_MACHINEGUN
> 
> i'm fairly new to regexps also, there should be some way to solve it
> with it , but i dont know how :(


If the verb (killed) and the preposition (by) are always the same then:

$ perl -le'
$line = q[^7Kore^7Adam killed BEST I TEST by MOD_MACHINEGUN];
my ( $killer, $whom, $what ) = split /\s*(?:killed|by)\s*/, $line;
print "Killer: $killer";
print "Whom: $whom";
print "What: $what";
'
Killer: ^7Kore^7Adam
Whom: BEST I TEST
What: MOD_MACHINEGUN



John
-- 
use Perl;
program
fulfillment

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

Reply via email to