On Sun, 2003-09-07 at 08:01, Jason Stubbs wrote: <snip> > # Can I combine the following two lines in any way? > # $mail_body = @$mail->body(); does not work. > $mail_body_ref = $mail->body(); > @mail_body = @$mail_body_ref;
@{$mail->body()} works here. If you want, you can also use foreach(@{$mail->body(}) below. > @body_text = split("\n", join(" ", @body_text)); > > @ntfy_mail = ("Date: $msg_date", > "From: $msg_from", > "Subject:$msg_subj", > "\n"); > > # Can I combine this into one line? Can I combine it with the above? > for ($i = 0; $i < 20; $i++) { > @ntfy_mail = (@ntfy_mail, "@body_text[$i]\n"); > } > Since you only want 20 lines you can use @body_text[0 .. 19] in the join. If you want to reduce everything to a few lines, you can use a second join to add the newlines: $text = join("\n", split("\n", join(" ", @body_text[0 .. 19]))); or use map to keep the result as an array: @body_text = map { $_ ."\n" } split( <same as above> ); Good luck, Doug
signature.asc
Description: This is a digitally signed message part