[ic] a little Perl help....

Paul Jordan interchange-users@icdevgroup.org
Fri Feb 7 21:24:00 2003


>
> I need a little bit of code that will take a block of text that's in a
> scratch variable and change all carriage returns to "%0a" and all double
> quotes (") to double-doubles ("").  Can anyone help?  Thanks!
>


take a look at this

http://www.icdevgroup.org/cgi-bin/ic/docfly.html?mv_arg=ictags04%2e28

You can make your own filter, and plop it right in the code/Filter directory
and restart. This page also has some to give you a start.

I am a beginner, but i think it would be something like:

  sub {
         my $val = shift;
         $val =~ s|\r?\n|%0a|g;
         $val =~ s:":"":g;
         return $val;
  },

or possibly...

  sub {
         my $val = shift;
         $val =~ s/\r?\n/\%0a/g;
         $val =~ s:":"":g;
         return $val;
  },

...untested

Paul