Jason Stubbs ([EMAIL PROTECTED]) scribbled:
> On Tuesday 02 September 2003 10:50, Marshal Newrock wrote:
> > On Mon, 1 Sep 2003, Jason wrote:
> > > above, what I want to do is:
> > >
> > > @sometext = ("text\n\with\nmore\nthan\none\nnewline\n",
> > > "some\nother\nline\n");
> > > @newtext = ("text\n", "with\n", "more\n", "than\n", "one\n", "newline\n",
> > > "some\n",
> > > "other\n", "line\n");
> > > #Do something magic to @sometext here to make it turn into @newtext
> >
> > Just two things:
> > 1) perldoc -f split
> > 2) man perlfunc
> >
> > Perl typically excels at text processing.  You can also look at the
> > 'join' command if you wish.  But certainly 'man perlfunc' along with
> > 'perldoc -f $function_name' will let you go far with your scripts.  :)
> 
> Sorry for the extremely late reply. Thanks for the info. I eventually used it 
> to write a working script, which I have included below.
> 
> I was using "man perl*" quite often. I haven't read all the way through 
> anything except perlintro yet though. I find when looking up language 
> reference, you have to know what you want to be able to find it. That is to 
> say, I don't tend to search for how a function works unless I expect the 
> function to exist. Needless to say, I didn't think the function to exist - 
> even though I knew that perl's forte is text-processing. This is my first 
> attempt at anything in perl, too!
> 
> Still a bit of functionality to add before I'll be happy - but I'll do that as 
> needed. There's also two bugs, one small and one big, but I'll work on those 
> independently until I get too frustrated. ;-)
> 
> I do have a couple of questions which I haven't been able to find the answer 
> to. I've embedded them within the code.

This may be OT for this thread, but there may be a simpler way to
accomplish the same results.  iirc, you said you were using procmail to
filter incoming mail and wanted to use a perl script to send
notification to another email address. 

I do the exact same thing, but without the perl script.  Take a look at
this slice of my .procmailrc:

# Begin ~/.procmailrc

[EMAIL PROTECTED]

#-------------------------------------------------
# BEGIN SAFETY NET

#
# All mail to Maildir first
#

:0c
Maildir/


# END SAFETY NET

#
# Mail from work
#

:0hc                                     # h=header only, c=copy
* ^From.*(work|slavedriver|ballandchain) # usual filter
!$FWD_URGENT                             # send the header to cellphone

:0                                       # deposit msg to sep dir
* ^From.*(work|slavedriver|ballandchain)
WorkMail/

# End ~/.procmailrc

I am by no means even remotely good at procmail scripts, I just hacked
this once and stuck with it. All it does is copy the header info of the
relevant message to my cell phone's email address.  This way I know
right away if I need to check mail (or if innaccessible, call the
person).  btw - this only works well if people use short, clear subject
lines.  All you'll get is the sender's email address and subj.

HTH,

Cooper.

--
[EMAIL PROTECTED] mailing list

Reply via email to