On Tuesday, May 21, 2002, at 05:52 , Jake wrote:
[..]
> If the latter method works, that's cool, i havent tested it.  I will admit
> that as I learn this stuff, I tend to do everything the hard way first, 
> then trim it down.

I have test it on [darwin|solaris|redhat linux 7.2] - I could
get over to the windows2000 box if it were really required - but
I would need to rig it to be perlEnabled - and I just do not do
enough work over there to make that worth my time yet. the code is at:

http://www.wetware.com/drieux/pbl/cgi/ParseParmsToPara.txt

{ I think I will opt for the
        my $cr = chr(13);       # the ascii value for <CR> - the '\n'
        my $lf = chr(10);       # the ascii value for <LF> - the '\r'
        my $eol = "$cr|$lf" # the either or pack here.

since, well it's almost like

        use constant <CR> => chr(13);

without the emotional crisis }

about the only principle place we 'disagree' is that I tend to
do it the hardWay and then find that there was a module at the CPAN
when I have to go back and rewrite some or all of it....

> On Wednesday, May 22, 2002, at 06:28 , Matthew Weier O'Phinney wrote:
[..]
>
> The problem with using patterns such as s/$/<p>/m is that while it will
> match the end-of-line condition, it will not _replace_ it (see
> Programming Perl, chapter 2, on Regular Expressions and the s///
> operator).

Good Point!!!

but if you wanted to 'clean em all'

        $line =~ s/[$eol]+/\n/g

would find the case of

        \r
        \r\n
        \n
        \r\n\n
        ....

and replace them all with a single '\n' for all
occurances in the $line that one is going through....

ciao
drieux

---

so far I have figured out

        a) Perl' RegEx is like lex and yacc,
                but without all the make files

        b) like sed and awk, but all in one process....


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

Reply via email to