--- Julien Motch <[EMAIL PROTECTED]> wrote: > I am new to perl and here is my problem .I have written a programm > which checks my mail and sends me instant message via gabber when > 10 or more mail arrive or when a special sender writes me . > The problem is that I receive the message head in one string . > I want to isolate the line which contains the word 'Subject:' > (by the way of grep do it ).Do you know a way to do that ?
Try splitting the data into lines. my $subject = grep { /^Subject:/i } split /\n+/, $data; You could also just use a regex: my($subject) = $data =~ /^Subject: (.+)$/m; That also captures the subject for you. Note that the parens around $subject are required for a list context so that the m// returns the string instead of the number of matches, and the m so that it delineates lines within the text. Note that this isn't something I do often, so please read the docs for yourself, and CAVEAT EMPTOR. =o) __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]